CSScompressor Nederlands

What is CSS minification?

Minifying CSS means removing everything a browser does not need to read while leaving the meaning exactly as it was. It is one of the cheapest speed improvements you can make, and also one of the most overstated. This page explains what actually happens, what it is worth, and where it goes wrong.

What a minifier removes

Walk through a stylesheet as a browser sees it and most of the file turns out to be for human eyes:

  1. Indentation and line breaks. Usually the single biggest chunk. A file formatted with four-space indentation and one declaration per line carries roughly one byte of whitespace for every three bytes of code.
  2. Comments. Useful in the source, dead weight on the wire.
  3. The last semicolon in each block. color:red;} and color:red} mean the same thing.
  4. Redundant spacing around punctuation. Around {, }, :, ;, , and the combinators >, +, ~.
  5. Longer-than-necessary values. #ffffff → #fff, 0.5em → .5em, 0.50em → .5em, 0px → 0.
  6. Empty rules. .unused {} does nothing at all.

What it does not do is change which rules apply to which elements. Minification is a text transformation with the same meaning on both sides. Anything that changes behaviour — merging rules, dropping properties it thinks are unused, reordering declarations — is optimisation, not minification, and carries real risk.

What it is actually worth

Two numbers matter, and people usually quote the wrong one.

Raw saving is what you see in this tool: typically 15 to 35 percent for hand-written CSS, and much less for CSS that came out of a build tool, which was already partly tidy. A big framework file can show 60 percent or more, mostly because of its comment headers.

Saving over the wire is smaller, because your server almost certainly compresses the response with gzip or brotli first, and those algorithms are very good at repeated whitespace. Once gzip has had its turn, minification is usually worth another 5 to 12 percent. On a 60 KB stylesheet that is a couple of kilobytes — worth having, not worth an afternoon.

That is the honest framing: minify because it is free and automatic, not because it will transform your scores. If a page feels slow, the cause is nearly always images, third-party scripts or render-blocking requests — see CSS optimization for speed.

Where minifiers break things

Almost every broken-minified-CSS story comes down to a tool that treated the stylesheet as text and used search-and-replace. Four classics:

The fix is not to be more careful with regular expressions; it is to parse the CSS properly. That is what the CSS compressor on this site does, and why those four cases pass through unharmed.

Minify, gzip and brotli together

These are three different things and you want all three:

If you have to pick one to set up today, set up compression on the server. It applies to every file you will ever serve.

Is minifying the same as compressing?

No, though the words get used interchangeably. Minifying rewrites the file itself and the result is still valid CSS. Compressing (gzip, brotli) packs the bytes for transport and the browser unpacks them again. You can do both, and you should.

Should I keep the minified file in version control?

No. Commit the source and generate the minified file as part of your build, so the two can never drift apart.

Does minified CSS hurt SEO?

The opposite, mildly. Google renders pages and page speed is a ranking signal, so a smaller stylesheet helps a little. The file being unreadable to humans is irrelevant — search engines read the rendered page, not your formatting.

Other tools on this site

Read more