How to use
- Paste CSS into the input | a minified
.min.css, styles copied from DevTools, or your own code. - Beautify puts each rule and declaration on its own line with indentation. Choose the indent width, blank lines between rules, and one selector per line.
- Minify removes comments and unnecessary whitespace to shrink the file. License comments starting with
/*!are kept by default. - Copy the result or download it as a
.cssfile, and check the original size and percentage saved below.
What minify removes and what it keeps
| Removed | Example |
|---|---|
| Comments | /* mobile */ |
| Line breaks, indentation, repeated spaces | Many lines → one |
Spaces around { } ; , : > ~ |
a > b { color : red; } → a>b{color:red} |
| The last semicolon in a block | {color:red;} → {color:red} |
| Kept | Why |
|---|---|
Spaces around - and + in calc(100% - 8px) |
CSS requires them, or the expression breaks |
The space in .card :hover |
It differs from .card:hover (hovering a descendant vs. the card itself) |
The space in and (max-width…) |
and( would be read as a function and the media query ignored |
Text inside strings and url() |
Content must not change |
Example
.btn { color : #fff; padding: 8px 16px; } (41 bytes) becomes .btn{color:#fff;padding:8px 16px} (33 bytes), about 20% smaller. Real stylesheets with comments and indentation usually shrink more.
Things to watch out for
- Minify here is whitespace and comments only. Deeper optimizations | turning
#ffffffinto#fff, merging duplicate rules | are what build tools like cssnano or Lightning CSS do. - If your server sends CSS with gzip or Brotli, the real transfer savings are smaller than the numbers shown.
- Keep your original. Comments are gone from a minified file, and beautifying it again won’t bring them back.
FAQ
Can I make minified CSS readable again?
Yes | choose Beautify and a .min.css turns back into indented code. Only removed comments can’t be restored.
What about HTML or JavaScript?
Use the HTML Beautifier & Minifier and the JavaScript Beautifier & Minifier. Your code is never uploaded.