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.
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.
