CSS Minifier
What minification removes — and what it must not touch
CSS written for humans carries four kinds of removable bulk. Comments (/* … */) exist only for readers. Whitespace — newlines, indentation, repeated spaces — is layout for the eye; CSS parsing needs only single spaces in a few grammatical spots. Spaces around punctuation ({ } : ; , > + ~) are almost never significant. And the final semicolon in each declaration block is optional. Removing exactly those, and nothing else, is what this minifier does — the conservative, always-safe core of minification that production tools also start from.
What it deliberately does not do: shorten values (#ffffff → #fff), merge rules, drop “unused” selectors, or rewrite anything. Those optimisations need a real parser and knowledge of your HTML, and when they go wrong they break pages silently. A whitespace minifier cannot change what a stylesheet computes — the minified output above is character-for-character the same programme, just terser. One grammatical caution the tool respects: spaces inside values like calc(100% - 10px), font shorthand and content strings are significant or protected, and a naive squeeze can break them; the implementation here collapses runs of whitespace to single spaces rather than deleting them inside declarations, and leaves quoted strings untouched — the safe side of the line for a browser tool. For production pipelines, pair this with a parser-based tool; for a quick win on a hand-written stylesheet, this is the win.
How much does it actually save?
On hand-formatted CSS, whitespace-and-comments minification typically removes 20–50% of the bytes — heavily commented, loosely indented files save the most. The sample in the box starts at about 200 bytes and lands near 100. Real-world significance: CSS is render-blocking, so every kilobyte delays first paint, and on a stylesheet loaded by every page of a site the saving multiplies by every visit. Two honest qualifications. First, if your server serves gzip or Brotli — it should — compression already crushes repeated whitespace efficiently, so minification’s additional saving over the wire is smaller than the raw figure, often 5–15%; minified files still compress slightly better and parse faster. Second, minification is not a substitute for removing genuinely unused CSS, which is frequently the larger prize on sites assembled from frameworks. Do both: delete what you do not use, then squeeze what remains — this tool does the squeezing, in the open, where you can diff the result against your original before you ship it.
If you maintain a site by hand, the practical workflow is simple: keep one readable stylesheet as your only source, paste it here before each upload, and treat the minified byte figure it reports as a regression alarm. A sudden jump in the minified size from one week to the next is almost always something specific — a pasted framework block, a duplicated section, a comment the size of a novel — and catching it at this step is cheaper than wondering later why the site slowed down.
Frequently asked questions
Is minified CSS exactly equivalent to the original?
For this minifier, yes — it removes only comments, collapsible whitespace, insignificant spaces around punctuation and the optional final semicolon of each block. It does not merge rules, shorten colours, reorder anything or drop selectors, so the computed styles are identical. The caution that applies to every regex-style minifier: exotic strings containing comment-like sequences inside quoted text are a theoretical edge case — if your CSS embeds “/*” inside a content string, check that one rule after minifying. For ordinary stylesheets the output is safe to ship.
How much smaller will my CSS get?
Typically 20–50% before compression, depending on how generously the original was commented and indented. The tool shows your exact figures — bytes before, bytes after, percentage saved. Over the wire the gain is smaller if your server already gzips or Brotli-compresses (you should check that it does), because compression eats whitespace for breakfast; even then, minified CSS compresses a little further and always parses faster. The biggest wins come from combining minification with deleting unused rules.
Should I keep an unminified copy of my CSS?
Yes — always. Minified CSS is a build output, not a source file: it is miserable to read, diff and debug. Keep the readable original in your project (and version control), minify for deployment, and if you need to debug the live site, browser dev tools can pretty-print the minified file back into readable form. Teams usually automate this with their build pipeline; this page is the manual equivalent for a quick job, a single file, or checking what minification would actually buy you.
Does minification help SEO or page speed scores?
Indirectly, yes. CSS blocks rendering, so a smaller stylesheet shortens the time to first paint, which feeds into the loading metrics (like Largest Contentful Paint’s render delay) that users feel and that speed tools report. Minification alone rarely transforms a score — an oversized framework stylesheet needs unused-CSS removal and critical-CSS work for that — but it is free, safe and instant, which is why it is step one of every CSS performance checklist rather than an optional extra.
Why not minify HTML and JavaScript the same way?
JavaScript minification needs a real parser — whitespace there can be significant (automatic semicolon insertion, strings, template literals, regular expressions), and the big wins come from renaming variables, which only a parser can do safely. HTML tolerates whitespace removal in most places but not inside pre, textarea or script blocks. This page minifies CSS because CSS is the one language where the safe core of the job is this simple; for JS, use a parser-based tool from your build pipeline rather than any regex tool, including one we could have written here.
Related tools
Behaviour verified in Node on 24 November 2026. Everything runs in your browser — nothing you type is sent anywhere.