CSS minifier

Paste your stylesheet and get a smaller version with comments, line breaks and extra spaces removed, plus the bytes and percentage saved. It is free and your code never leaves your browser.

How to use it

  1. Paste your CSS in the Your CSS box.
  2. The Minified CSS appears below, with the original size, new size and percentage saved.
  3. Click Copy or Download and use the result in production.

Complete guide to minifying CSS

What minifying CSS does and why it matters

Every byte of a stylesheet has to be downloaded before the browser can draw the page, because CSS blocks rendering. Comments, indentation and line breaks help people read the file but mean nothing to the browser. Minifying removes them, so the same styles travel in fewer bytes. The saving depends on how many comments and spaces the file contains (the example below goes from 125 to 85 bytes), and it adds to what gzip or Brotli already does on the server. Keep your readable source file and publish the minified copy.

What this tool removes and keeps

RemovedKept exactly as written
CommentsComments that start with /*!, usually licenses
Line breaks and indentationQuoted strings, including any spaces or comment-like text inside them
Spaces around { } : ; , and the combinators > + ~Unquoted url() values
The last semicolon before a closing braceSpaces that separate values, such as in 8px 16px

It does not merge rules, shorten colors (#ffffff stays as is), drop units or reorder anything. That is a deliberate choice: the output is predictable and the styles behave the same. The minification runs in your browser and nothing is uploaded. The tool shows the original size, the minified size, the bytes saved and the percentage, measured in UTF-8 bytes.

Worked example

Paste this into Your CSS:

/* Buttons */
.btn {
  color : #ffffff;
  background: #0a6cff;
  padding: 8px 16px;
}

.btn:hover {
  background: #0856cc;
}

The Minified CSS is:

.btn{color:#ffffff;background:#0a6cff;padding:8px 16px}.btn:hover{background:#0856cc}

The Size panel reports 125 bytes before, 85 bytes after, 40 bytes saved, a 32% reduction. Real stylesheets save more when they contain many comments and deep indentation.

Tips and common mistakes

  • Never edit the minified file by hand. Change the source, then minify again. If you only have the minified file, run it through the CSS beautifier first.
  • Keep license comments as /*! ... */ if the license requires the notice to stay in the file.
  • Test the page after replacing the file. The tool is conservative, but a stylesheet with a syntax error will still be passed through as it is, errors included.
  • For the biggest gains, also remove unused rules and enable compression on your server. A minifier alone cannot know which selectors your pages never use.
  • If your build tool already minifies CSS, you do not need to do it twice.
  • Use the Download button to save the result as styles.min.css, so the minified copy has a name that is clearly different from your source file.

Related tools

You can compact the other parts of a page with the HTML minifier and the JavaScript minifier. If you need a fluid font size before minifying, the CSS clamp generator builds the value for you.

Questions

Is my CSS uploaded anywhere?

No. The minification runs in your browser and nothing is sent or stored.

What exactly does it remove?

Comments, line breaks, indentation, extra spaces and the last semicolon of each rule. Strings and url() values are kept exactly as written. Comments that start with /*! are kept.

Does it change how my CSS works?

It only removes characters that do not affect the result, so the styles behave the same. It does not merge rules or shorten colors, which keeps the output predictable.

Why is the saving smaller than in other tools?

Advanced minifiers also rewrite values and merge selectors. This tool stays on the safe side and only removes what is not needed.