1. Home
  2. Developer
  3. CSS Beautifier & Minifier

CSS Beautifier & Minifier

Format CSS for readability, or minify it by removing whitespace and comments.

For every format and option in one place, use Code Formatter and Checker →

Runs in your browser · No upload

Loading the beautifier…

Your CSS is processed in this browser and never uploaded.

How to use

  1. Paste CSS into the input | a minified .min.css, styles copied from DevTools, or your own code.
  2. 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.
  3. Minify removes comments and unnecessary whitespace to shrink the file. License comments starting with /*! are kept by default.
  4. Copy the result or download it as a .css file, 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 #ffffff into #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.

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.