CSS Minifier

Paste a stylesheet and get it back compressed. The counter under the box shows the size before and after, so you can see whether it was worth it.

The code never leaves this page: formatting happens in your browser.

How to use

  1. Paste the CSS into the first box — it is minified as you type.
  2. Compare the sizes shown below the input.
  3. Copy the result, or press «Format» to read it again.

Good to know

What gets removed

Comments, line breaks, indentation, the spaces around colons and combinators, and the final semicolon before each closing brace, which the standard never required. Selectors keep the single space that separates a descendant from its ancestor, because removing it changes what the rule matches.

Why strings are not touched

A semicolon inside content: "a;b" and a brace inside an inline SVG data URI both look like structure to a regular expression. Minifiers that work by pattern-matching break such files silently, and the damage shows up as a missing icon in production. This one reads the stylesheet character by character and carries quoted strings across whole.

Frequently asked questions

Does the stylesheet still work exactly the same?

Yes. Nothing is renamed, reordered or dropped — only whitespace and comments go, and neither affects how a rule is applied.

How much smaller will my file get?

A hand-written stylesheet usually loses twenty to thirty percent. After gzip the difference is much smaller, since compression already deals with repeated whitespace.

Is my code sent to a server?

No. The entire process runs on the page, which matters for stylesheets that are not public yet.

Can I read it again afterwards?

Press «Format» and the stylesheet is laid out with one declaration per line. The original comments are gone, but the rules are all there.

Related tools