CSS Minifier — Compress CSS for Production
Minify CSS source. Strips comments, collapses whitespace, removes redundant semicolons. Typical savings 20–50%. Runs in your browser.
Why minify CSS?
CSS minification removes everything from a CSS file that doesn't affect how it's interpreted — comments, indentation, line breaks, redundant whitespace, the optional last semicolon before each closing brace. The result is functionally identical CSS in 50–80% the file size. Smaller CSS files mean faster page loads, better Core Web Vitals scores, and lower bandwidth costs.
Most modern build pipelines (webpack, Vite, Parcel, esbuild) minify CSS automatically on production builds. This tool is for ad-hoc minification — quickly shrinking a hand-written CSS file before pasting it into a project, or auditing what production CSS would look like.
What this minifier does
- Strips comments —
/* ... */blocks. - Collapses whitespace between tokens, with safe spacing preserved.
- Removes the optional trailing semicolon before each
}. - Removes spaces around punctuation — selectors, declarations, commas.
- Preserves strings and url() values exactly.
Typical savings
- Hand-written CSS with comments — 40–60% smaller.
- Already-formatted CSS — 20–35% smaller.
- Already-minified CSS — 0–5% (no-op).
When to minify
- Before deploying to production. Always.
- Before embedding CSS in HTML (style tags, inline data URIs).
- Before sending CSS over a constrained channel (mobile data, satellite connections).
Tips
- Always keep the unminified source in version control. Minified CSS is unreadable when you need to debug.
- Combine with gzip/brotli for an additional 70%+ compression on the wire. Minification handles structure; HTTP compression handles repetition.
- Source maps let you debug minified CSS in browser DevTools. This tool doesn't generate source maps — full build tools do.
FAQs
Is anything uploaded?
No.
Will it break my CSS?
Conservative approach — preserves whitespace inside strings and url() values. Test minified output before deploying.
What about comments I want to keep?
Use /*! "important" comment syntax — preserved by most minifiers including this one.