Developer Tools
CSS Minifier & Beautifier
Paste or open a stylesheet to minify it for faster pages, or beautify it with clean indentation. Choose how comments are handled, see exactly how much smaller the file gets, and catch syntax errors.
Runs in your browser
Features
What you get
Safe minification
Whitespace, comments and redundant values removed — rules are never merged or reordered.
Readable beautify
One declaration per line, consistent indentation, selector lists split, nested @media and @keyframes indented.
Comment control
Keep /*! licence */ comments (default), remove them all, or keep every comment.
Final semicolons
Keep or drop the last semicolon in each rule — handy for diff-friendly output.
Size comparison
Original and output size in bytes with the exact percentage saved.
Syntax checks
Unbalanced braces, unclosed strings or comments and parse errors with line numbers.
How to use
How to use the CSS Minifier & Beautifier
Minification uses csso, an established open-source CSS optimiser built on a full CSS parser, with restructuring turned off — so rules are never merged or reordered, which keeps the cascade exactly as you wrote it. It shortens values safely (0px → 0, #ffffff → #fff) and keeps /*! licence */ comments by default. Beautifying uses a character-level tokenizer that understands strings, comments, url() and brackets, so a } inside a string can't break a rule. Syntax errors are found with the same parser in tolerant mode.
- 01
Add your CSS
Paste it, open a .css file, or load the sample.
- 02
Minify or beautify
Choose an action, indentation, comment handling and semicolons.
- 03
Copy or download
Check the size saved and any warnings, then copy or download styles.min.css.
Examples
Worked examples
Shorter values
margin: 0px 0px 0px 0px; color: #FFFFFF → margin:0 0 0 0;color:#fff — the meaning is identical.
Licence comments
/*! MIT licence */ is kept by default; ordinary /* notes */ are removed.
Strings are safe
content: "a } b" stays intact — the } inside quotes isn't treated as the end of a rule.
Technical specifications
- Minifier
- csso 5 (restructure off)
- Comments
- Keep /*! */, remove all or keep all
- Indentation
- 2 spaces, 4 spaces or tab
- Checks
- Braces, strings, comments, parse errors
- File types
- .css (up to 5 MB)
- Output
- Copy or download .css
Privacy
CSS is processed in your browser and never sent or stored.
Read the full privacy policy.
FAQ
CSS Minifier & Beautifier questions
A CSS minifier removes everything a browser doesn't need — whitespace, comments, redundant zeros and units — to make stylesheets smaller. A beautifier does the opposite, laying the rules out one declaration per line. ZSpace Tools' CSS Minifier & Beautifier does both, and reports syntax errors with line numbers.
Minification uses csso, an established open-source CSS optimiser built on a full CSS parser, with restructuring turned off — so rules are never merged or reordered, which keeps the cascade exactly as you wrote it. It shortens values safely (0px → 0, #ffffff → #fff) and keeps /*! licence */ comments by default. Beautifying uses a character-level tokenizer that understands strings, comments, url() and brackets, so a } inside a string can't break a rule. Syntax errors are found with the same parser in tolerant mode.
It shouldn't. Restructuring is off, so rules keep their order and the cascade is unchanged; only whitespace, comments and equivalent shorter values are changed. As with any build step, check the result before deploying.
A convention for comments that must be kept, usually licences. They're kept by default when minifying; choose Remove to drop them too.
To keep every comment in place, the tool only collapses whitespace in that mode and doesn't optimise values. Use the default for the smallest file.
Yes — custom properties, @media, @supports, @layer, @container, @keyframes and nesting are parsed. Custom property values are kept as written.
No. It doesn't add prefixes, remove unused selectors or merge rules — it only shrinks or formats what's there.
No. Everything runs in your browser.
Related tools
HTML Formatter & Minifier
Beautify messy HTML with clean indentation, or minify it for production.
Color Picker & Converter
Pick colours, convert HEX, RGB(A) and HSL(A), build palettes and check contrast.
JSON Formatter & Validator
Beautify, minify and validate JSON, with exact line and column for every error.