What is Minification?
Compressing source code by stripping whitespace, shortening identifiers, and simplifying expressions without changing behavior.
Definition
Minification shrinks shipped code: Terser and esbuild rename variables to single characters, remove comments and whitespace, inline constants, and drop unreachable branches—often cutting JavaScript size 40–60% before gzip or Brotli compression takes it further. CSS minifiers like Lightning CSS merge duplicate rules and shorten color values; HTML minifiers collapse whitespace. Minification is distinct from obfuscation (making code hard to reverse-engineer) and from tree shaking (removing unused modules); production pipelines apply all of these together. Source maps are the essential companion, mapping mangled output back to original code so stack traces in tools like Sentry remain debuggable.

