Minify CSS
Strip comments and whitespace and shorten values. And if the minifier cannot handle something in your file, it says so — instead of quietly handing back a stylesheet with rules missing.
- Processed on your device
- No upload, no waiting
- No signup, no watermark
The minified CSS appears here.
How it works
Paste your CSS
Or drop the file in. Nothing is uploaded.
Read the result
You get the minified stylesheet and how much smaller it is — or an explanation of what could not be handled.
Copy or download
Ready to drop into your build.
Frequently asked questions
Is my CSS uploaded?
No, and for source code that is the point. Nothing is uploaded and no request leaves your device. Pasting proprietary source into an online minifier that posts it to a server is a disclosure, whatever the site says about retention — and it is exactly the sort of thing that is done in a hurry without thinking.
Why did it refuse my file?
Because minifying it would have lost rules. The engine behind this page is csso, which is excellent but dates from 2022 and does not know about two things that are now ordinary CSS. Given native nesting — a rule written inside another rule, with or without "&" — it returns the outer rule and SILENTLY DROPS the nested one. Given a modern media range query such as @media (width >= 400px), it returns an empty stylesheet. Neither produces an error. We measured both on the exact version we ship, and decided that handing someone a stylesheet with styles missing is worse than declining, so those two cases are detected and refused. Rules are also counted before and after as a general check, in case there is a third case nobody has found yet.
How do I minify nested CSS then?
Compile the nesting away first. Every build tool that supports nesting — Sass, PostCSS, Lightning CSS, or your bundler — flattens it as part of building, and the flattened output minifies here without complaint. If you are writing nesting by hand and serving it directly, you are relying on a feature that is supported in current browsers but the minifier ecosystem has not entirely caught up with.
What does it actually do?
Removes comments and whitespace, shortens colours (#ffffff becomes #fff, #ff0000 becomes red), trims unnecessary units and semicolons, and merges what can safely be merged. It does not remove rules it thinks are unused — that needs to know your HTML, and guessing wrong deletes styles you need.
How much smaller will it get?
For hand-written CSS, usually 15–30%. Already-compiled output from a build tool is often nearly minimal and will barely move. Gzip on your server does more than minification does; the two compound.
Which library is it?
csso 5.0.5, MIT-licensed, served from this site rather than a CDN and downloaded only when you open this page. Its limitations are described above rather than hidden.