Comparisons

Pairs that get conflated in real conversations, and in real pull requests. Neither column wins — what decides is the requirement. Each record leads with the confusion, because the confusion is the reason the record exists.

Minification vs Compression

What people get wrong about this pair

They are treated as the same optimisation because both make the number in the network panel smaller, and a team that has enabled Brotli will say "we already minify". They act at different layers and they do not substitute for each other. Compression is very good at repeated text, so a long identifier repeated forty times costs almost nothing on the wire — which is exactly why people conclude minification is pointless. But the browser decompresses before it parses: what the JavaScript engine has to tokenize, parse and compile is the *minified* size, not the transferred size, and on a mid-range phone that parse and compile work is often the part the user actually feels. Minification also removes code that compression can only make cheap to send. The honest framing is that compression reduces network time and minification reduces both network time and main-thread time.

Minification (a build-time source transform)
Use it when

Always, in a production build: it removes whitespace, comments and dead code, shortens local identifiers and rewrites expressions into equivalent shorter ones. The output is still valid JavaScript or CSS.

Compression (a transfer-time encoding — gzip, Brotli, zstd)
Use it when

Always, at the server or CDN: the bytes on the wire are encoded and the browser decodes them before parsing. It applies to the minified output, not instead of it.

DimensionMinification (a build-time source transform)Compression (a transfer-time encoding — gzip, Brotli, zstd)
Happens atBuild time, onceResponse time, per request (or once, pre-compressed)
Output isValid, smaller sourceAn encoded byte stream the browser must decode
What the engine parsesExactly this — the minified textThe decoded original; compression is already gone by then
Removes dead codeYes, together with tree shakingNo — it only makes it cheap to transmit
CostBuild time, and debugging needs source mapsCPU on the server or CDN, and on the client to decode
Who configures itThe bundlerThe server, CDN or edge
Skipping it meansMore parse and compile work on every deviceMore bytes and more network time, especially on slow links