CSS Minifier

Shrink stylesheets safely for production with comment preservation and hex shortening.

Minify CSS instantly in your browser. Free CSS minifier removing comments and whitespace, shortening hex colors, with size savings.

Calculator Inputs

About Minify CSS

Shrink stylesheets safely for production with comment preservation and hex shortening.

Paste CSS to strip comments (except important /*! */ banners), collapse whitespace around braces, colons, and combinators, drop redundant trailing semicolons, and shorten #aabbcc hex codes. Byte counts before and after prove the saving.

This is a whitespace-and-comment minifier, not a full optimizer: it never merges rules or restructures selectors, so output is behavior-identical. For maximum savings pair it with gzip/brotli serving. Everything runs in your browser.

Where it is used

Pre-deploy optimization, auditing how much whitespace a file carries, and teaching what minifiers actually do.

How to use the Minify CSS

  1. CSS Source — enter the value (e.g. /* theme */ .card { color: #aabbcc; }).
  2. Calculate — press the Calculate button to see the result instantly above.

Formula

Strip comments (keep /* ! */) → collapse structural whitespace → drop last semicolons → shorten hex.

Examples

Example

cssInput:/* theme */ .card { color: #aabbcc; margin: 0; }
Result: .card{color:#abc;margin:0}

Frequently Asked Questions

Is the output guaranteed equivalent?
For standard CSS, yes — only comments, redundant whitespace, and hex spellings change. Exotic hacks (old IE filters, content strings with braces) deserve a manual glance.
Do I still need gzip?
Absolutely. Minification typically saves 15–30%; gzip on top saves another 60–80%. They multiply.
Why keep /*! comments?
By convention they carry licenses and attribution that must survive distribution. Everything else is fair game.