Skip to main content
ToolsHub

CSS Minifier & Beautifier

Minify CSS to reduce file size and improve page load speed. Also beautify/format minified CSS for readability. Shows exact size reduction.

Updated

Files never leave your browser

No output yet

Paste CSS on the left to see the result here.

How to use CSS Minifier & Beautifier

The CSS Minifier removes whitespace, comments, redundant semicolons and other unnecessary characters from CSS stylesheets to reduce file size and improve page load performance. Minified CSS can be 20–40% smaller than the original, directly reducing the bandwidth required to deliver stylesheets and shortening the render-blocking time that delays First Contentful Paint.

  1. Paste your CSS code into the input area or upload a .css file.
  2. Choose minification options: remove comments, collapse whitespace, remove redundant semicolons, merge duplicate selectors.
  3. Click Minify to produce the compressed output.
  4. Review the size-reduction statistics (original size, minified size, savings percentage).
  5. Copy the minified CSS or download it as a .min.css file.
  6. To reverse the process, use the Beautify / Format option to re-indent minified CSS for debugging.

Your data never leaves your device — 100% private processing.

What CSS minification removes

CSS minification performs several transformations: it strips all comments (/* ... */), collapses multiple spaces and newlines to a single space or nothing, removes the final semicolon before a closing brace, shortens colour values (#ffffff → #fff, rgb(255,255,255) → #fff), removes leading zeros from decimal values (0.5em → .5em), and removes units from zero values (0px → 0). Advanced minifiers also merge adjacent rules with identical selectors and remove duplicate properties, though these transforms carry a small risk of changing cascade behaviour.

Minification vs compression (gzip/Brotli)

Minification and HTTP compression are complementary, not alternatives. Minification removes semantic redundancy, making the file smaller before compression. Gzip and Brotli then apply general-purpose dictionary compression, which works best on repetitive text. A minified CSS file typically compresses better than an un-minified one because repeated tokens (property names, values) are more densely packed. For production, always apply both: minify at build time and serve with Brotli (preferred) or gzip via your CDN or web server.

Typical CSS size reduction stages
StageTypical sizeReduction from original
Original (authored)100 KB
After minification70–80 KB20–30% smaller
After minification + gzip15–20 KB80–85% smaller
After minification + Brotli12–16 KB84–88% smaller

Worked examples

Minify a rule

Inputs: body { color: #ffffff; margin: 0px; }

Result: body{color:#fff;margin:0}

Strip comments

Inputs: /* nav */ .a { color: red; }

Result: .a{color:red}

Typical size saving

Inputs: 10 KB of readable CSS

Result: often 20–40% smaller before gzip

Glossary

Minification
Removing all non-essential characters from source code without changing its functionality.
Dead code elimination
Removing CSS rules that are never applied to any element in the document.
Brotli
A modern compression algorithm developed by Google that typically outperforms gzip by 15–25%.
Critical CSS
The minimal CSS required to render above-the-fold content; inlined in <head> to eliminate render-blocking requests.
Source map
A file that maps minified code back to original source lines, enabling debugging of minified production assets.

Related reading

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Related Developer Tools

Explore all Developer Tools.