Developer Tools

CSS Minifier

Minify CSS online for free: strip comments and whitespace, shorten hex colors, drop units from zero values, and beautify minified CSS back into readable code. 100% in your browser, no signup.

Your result will appear here.

⚡ Minifying only removes things a browser does not need: comments, whitespace, the last semicolon in a rule, and redundant characters. The page renders exactly the same, but the file is smaller, downloads sooner and blocks rendering for less time. CSS is render-blocking, so a smaller stylesheet improves First Contentful Paint and Largest Contentful Paint, two Core Web Vitals metrics.

🔒 Privacy: minifying and beautifying run locally in your browser. Your CSS is never uploaded, stored or seen by anyone else.

More developer tools

How this calculator works

A CSS minifier shrinks a stylesheet by removing everything the browser does not need: comments, indentation, line breaks and redundant characters. The page renders exactly the same, but the file is smaller, downloads sooner and blocks rendering for less time. CSS is render-blocking, which means the browser will not paint the page until it has downloaded and parsed your stylesheets, so a smaller file improves First Contentful Paint and Largest Contentful Paint, two metrics inside Google Core Web Vitals. Paste a stylesheet here, or upload a .css file, and the minified version appears instantly with the character count before and after and the percentage you saved.

This minifier is a small scanner that understands CSS, not a blind text replacer. It removes comments, collapses whitespace, drops the last semicolon in each rule, shortens #ffffff to #fff, turns 0px, 0em and 0% into plain 0, and deletes empty rules. Five toggles let you control each step, and license comments starting with /*! are kept by default so attribution survives. What it never touches is just as important: the spaces around + and - inside calc() stay exactly as they are, because calc(100% - 20px) breaks without them, and quoted strings and url() values pass through untouched, so content strings and image paths are never mangled.

The beautify mode does the reverse: it turns a minified file back into indented, readable CSS, one declaration per line, which is handy when you inherit a minified chunk from a legacy CDN or a copied DevTools panel and need to read it. A build tool such as cssnano or Lightning CSS will usually save more on a full project, because it understands source maps and merges rules, but for an ad hoc paste workflow this tool is faster: no install, no config, no upload. Keep in mind that real transfer sizes will be smaller again once the server applies gzip or Brotli, so the percentage shown here is the raw saving before compression.

Frequently asked questions

How do I minify CSS online?
Paste your stylesheet into the input box, or upload a .css file. The minified version appears instantly, with the character count before and after and the percentage saved. Copy the result or download it as a .css file. Nothing is uploaded: minifying runs in your browser.
Is minified CSS still valid?
Yes. Minifying only removes things a browser does not need to render the page: comments, whitespace, the last semicolon in a rule, and redundant characters like the units on zero values. The output is valid CSS that browsers parse identically to the original.
Will it break calc() expressions?
No. The minifier is string-aware and understands calc(): the spaces around + and - inside parentheses are required by CSS and are kept exactly as they are. Quoted strings and url() values are also left untouched, so content strings and image paths are never mangled.
What exactly does the minifier remove?
Comments (license comments starting with /*! are kept by default), whitespace and line breaks, the last semicolon in each rule, shortened hex colors (#ffffff becomes #fff), units on zero values (0px becomes 0), and empty rules with no declarations. Each step can be toggled off.
How much smaller will my CSS get?
Most stylesheets shrink by 15 to 40 percent, depending on how many comments and how much formatting the original contains. A heavily commented, hand-formatted file saves more than an already compact one. The tool shows the exact percentage for your file, before gzip or Brotli compression, which shrinks the transfer size further.
What is the beautify mode for?
Beautify turns a minified file back into indented, readable CSS with one declaration per line, so you can read a chunk copied from a legacy CDN, a minified theme file, or a DevTools panel. It does not restore the original comments, which minifying removes permanently.
Disclaimer: Results are estimates for planning purposes only and are not financial advice. Actual loan terms, taxes and investment returns vary. Consult a qualified professional before making financial decisions.