CSS Minifier & Beautifier - Compress CSS or Make It Readable
Every kilobyte of CSS delays the first paint of your page. Paste a stylesheet below to compress it for production, or run a minified file through Beautify when you need to read and edit it again.
How to use the CSS Minifier
- Paste or type your CSS into the top box.
- Click Minify CSS to compress it, or Beautify CSS to format it with indentation.
- Check the size panel - it shows the original size, result size and percentage saved.
- Copy the result or download it as a .css file.
How it works
The minifier first walks your CSS character by character and removes comments - while leaving quoted strings completely untouched, so a content value that happens to contain comment-like text survives intact. It then collapses whitespace runs and removes spaces around braces, semicolons, commas and combinators, plus the space after colons. It deliberately never touches the inside of calc() expressions or string values, where spaces carry meaning. Beautify mode reverses the process: it re-opens the compressed CSS into one declaration per line with two-space indentation per nesting level.
Worked example
A typical hand-written stylesheet rule with comments and generous spacing - say a 240-byte header block - usually minifies to around 150 bytes, a saving of roughly 35-40%. Across a whole site that adds up to a visibly faster first render, especially on mobile connections.
Frequently Asked Questions
Is this CSS minifier free?
Yes - completely free, with no sign-up, no size limit and no daily cap.
Is minified CSS safe to deploy?
The minifier only removes comments and whitespace that CSS does not need. Selectors, properties and values are unchanged, and string values and calc() expressions are never altered. As with any minifier, test the page once after deploying.
Why does it keep a space before a colon in selectors?
A space before a colon can be meaningful in CSS - ".a :hover" selects hovered descendants, while ".a:hover" selects the element itself. To stay safe, the tool removes the space after colons but never guesses with the space before one.
Can it beautify CSS as well?
Yes. Beautify mode takes compressed CSS and expands it to one declaration per line with consistent indentation, which is ideal when you inherit a minified file and need to edit it.
Is my CSS uploaded to a server?
No. Minifying and beautifying happen 100% in your browser. Your stylesheets never leave your device.
Related Developer Tools
JavaScript Minifier
Conservatively minify JavaScript - comments and dead whitespace removed, strings and regex kept intact.
JSON Formatter
Validate, pretty-print and minify JSON, with the exact position of any error.
HTML Entity Encoder
Escape text into HTML entities (named or numbered) and decode entities back to text.