CSS Minifier & Beautifier
Minify CSS to reduce file size, or beautify minified CSS for readability. Instant, browser-based.
CSS Input
Minified Output
Frequently Asked Questions
Is my CSS stored on your servers?
No. All minification is done in your browser using JavaScript. Your CSS is never sent to any server.
What does CSS minification do?
Minification removes comments, unnecessary whitespace, trailing semicolons, and redundant characters — reducing file size without changing how the CSS works.
How much can CSS minification reduce file size?
Typically 20–40% smaller, depending on how much whitespace and comments the original has. Combined with Gzip/Brotli compression by your server, the savings are even greater.
Can I beautify / format CSS too?
Yes. Use the Format button to prettify minified or messy CSS with consistent indentation and spacing.
What CSS Minification Removes
CSS minification is a lossless transformation: the rendered result in the browser is identical. The minifier strips everything the browser does not need to parse the stylesheet:
- Whitespace and newlines — indentation, blank lines, spaces around
:and{}. - Comments —
/* ... */blocks (except/*! ... */license comments). - Trailing semicolons — the last declaration in a rule block doesn't need a semicolon.
- Redundant units —
0px→0. - Longhand properties — some minifiers merge
margin-top/right/bottom/leftinto shorthandmargin.
CSS Optimization Pipeline
In a modern web project, CSS minification is one step in a multi-stage optimization pipeline. The typical order is:
- Autoprefixer — adds vendor prefixes (
-webkit-) based on browser targets. - PurgeCSS / tree-shaking — removes CSS rules not used in your HTML/JS (can reduce Tailwind from 3 MB to 10 KB).
- Minification — strips whitespace and comments from the remaining CSS.
- Gzip / Brotli compression — server compresses the minified file for transfer. Brotli saves an additional 15–20% over Gzip on CSS.
Minification in Build Tools
- Vite — uses
lightningcss(Rust) orcssnanoautomatically in production builds. - Next.js — built-in CSS minification via SWC / PostCSS in
next build. - webpack —
css-minimizer-webpack-pluginwraps cssnano. - esbuild — native
--minifyflag handles CSS minification at near-instantaneous speed.