CSS Minifier
Minify CSS online. Remove comments and whitespace, shorten colours and units, merge duplicate rules, and check the savings. Level 2 optimisations are optional.
Free, no sign-upRuns in your browserNothing uploaded
Press Minify to see the result.
- input
- 325 B
- output
- 0 B
- saved
- -
- after gzip (est.)
- -
The estimated compressed figure matters more than the raw one. Gzip and Brotli already squeeze whitespace and repeated tokens, so a 40% raw reduction is usually only a few percent once the file is compressed. Minify anyway, but judge it on the compressed number.
CSS minification removes comments and the whitespace around selectors and declarations, and rewrites values into their shortest equivalent form: #FFFFFF becomes #fff, 0px becomes 0, 0.5 becomes .5, and margin: 0 0 0 0 collapses to margin: 0. On production stylesheets that is typically 20 to 40% off the raw file.
The output uses clean-css, a battle-tested minifier that understands the CSS grammar rather than pattern-matching it, so it will not break a string containing a brace or mangle a custom property. Higher-level optimisations such as merging structurally identical rules and removing overridden declarations are available as opt-ins, and each one is a separate step because that class of transform is where minifiers occasionally disagree with browsers.
As with any minifier, the meaningful number is the compressed size. Gzip and Brotli handle whitespace and repeated tokens well, so a 30% raw reduction often becomes only 2 to 5% after compression. Minify, then compare the compressed sizes, and do not skip brotli because of it.
CSS Minifier features
How to use the CSS Minifier
Paste your CSS
Type or paste, or drop a .css file onto the editor.
Choose the level
Level 1 is safe and predictable: comments and whitespace gone, values shortened. Level 2 additionally merges identical rules and drops overridden declarations. Advanced restructuring rewrites selectors and can change cascade behaviour - leave it off unless you verify the result.
Compare the output
Raw and compressed sizes, percentage saved and the list of optimisations applied are all reported.
Copy or download
Copy the minified CSS or download it as a .css file, then reload the page and check for visual regressions.
Frequently asked questions
Is it safe to minify CSS?
Why is my minified CSS only slightly smaller once compressed?
Should I delete my source map after minifying?
What do the optimisation levels actually do?
Does it handle CSS custom properties?
Can I minify SCSS or Less?
Related tools
Every tool, in one place
ToolForge has css minifier plus a growing set of image, colour and developer tools. All of them run locally in your browser, free and without an account.
Browse all tools