What minifying removes
Minifying CSS strips every character a browser does not need: comments, line breaks, indentation, and the spaces around braces, colons, semicolons and commas. The rules and values are untouched, so the page renders identically — it just downloads faster.
Because CSS is whitespace-insensitive between tokens, removing it is safe. The minifier also drops the final semicolon before each closing brace, which the spec allows, shaving a few more bytes off large files.
Worked example
The rule on the left collapses to the compact form on the right:
.card { color: #333; padding: 16px 20px; }.card{color:#333;padding:16px 20px}What it keeps safe
The minifier preserves strings, url() values and the meaningful single spaces inside multi-value properties like margin: 0 auto or font: 14px/1.5 sans-serif, where the space separates real values. It only collapses insignificant whitespace, so your styles behave exactly the same. Everything is processed locally, so proprietary stylesheets never leave your browser.
Minification vs gzip vs brotli — they stack
A common question: "if my server already gzips CSS, why minify?" Because the two work on different things and combine. Minification removes characters the browser never needed; compression (gzip or brotli) then re-encodes what's left into fewer bytes over the wire. The browser decompresses on arrival, so you pay no runtime cost.
| Stage | What it does | Typical effect on hand-written CSS |
|---|---|---|
| Original | Readable source with comments and indentation | 100% (baseline) |
| Minified | Comments and insignificant whitespace removed | ~55–75% of original |
| Minified + gzip | Plus general-purpose compression | ~15–25% of original |
| Minified + brotli | Brotli (supported by all modern browsers over HTTPS) compresses CSS/JS noticeably better than gzip | ~12–20% of original |
The numbers above are typical for hand-authored stylesheets; your mileage varies with how repetitive your CSS is. The takeaway: minify and enable brotli (or gzip as a fallback) at the server or CDN. Skipping minification before compression still leaves comments and whitespace in the decompressed file, so it isn't a substitute.
What this tool deliberately doesn't do
This is a safe, structural minifier — it removes whitespace and comments and trims the final semicolon before each }. It does not attempt the riskier optimisations that full build tools (cssnano, Lightning CSS) perform, because they need a real CSS parser to do safely:
- Merging duplicate selectors and dropping rules overridden later — easy to get wrong when specificity or source order matters.
- Shortening colours (
#ffffff→#fff, named colours → hex) and collapsingmargin/paddingshorthands. - Removing unused CSS — that requires scanning your HTML and JavaScript, which a paste-in tool can't see.
For a one-off file or a quick check this whitespace minifier is ideal. For a production pipeline, run a parser-based minifier as part of your build so those structural wins are applied safely with the markup in view.