CSS Minifier
Minify CSS by removing comments, whitespace and unnecessary characters. See original and minified size with savings percentage. Copy or download the result.
What Minification Actually Removes
CSS minification strips whitespace, comments, and the redundant trailing semicolons before each closing brace. A 4KB hand-formatted stylesheet typically shrinks to between 2.5KB and 3KB after this pass, a saving of 25-40%. Add gzip on top and the over-the-wire size drops further; brotli, where it's available (everywhere except Internet Explorer), usually beats gzip by another 10-20% on text payloads.
The tool runs everything client-side as you type. Paste your stylesheet and the minified output appears alongside an exact byte count for both versions and the percentage saved. There is no upload to a server, no rate limit, and no file-size cap beyond what your browser's memory can handle. Hit Copy to grab the result, or Download for a .css file.
When Build Tools Beat a Manual Minifier
If you're shipping a Next.js, Vite, or Webpack project, your bundler already minifies CSS using cssnano or LightningCSS as part of the production build. That pipeline does more than whitespace stripping: it merges duplicate rules, shortens hex colours from #ffffff to #fff, collapses font shorthand, and removes vendor prefixes that target dead browsers. A standalone tool like this one is useful for quick wins on hand-written CSS, single-file demos, email templates, or one-off WordPress themes where there's no build step.
One thing to watch: aggressive minification can break calc() expressions if it strips spaces around the inner operators, since 'calc(100% -16px)' is invalid but 'calc(100% - 16px)' is correct. This tool is conservative and preserves spaces inside parentheses, but if you ever migrate to a heavier minifier, run a visual regression check on layouts that use calc(), clamp(), or min/max.
What Minifies and What Doesn't
| Element | Minified? | Notes |
|---|---|---|
| Whitespace and newlines | Yes | Collapsed to single spaces or removed entirely |
| /* Comments */ | Yes | All block comments stripped |
| Trailing semicolons | Yes | ; before } removed |
| calc() spacing | No | Preserved to keep expressions valid |
| Class and ID names | No | Renaming requires a CSS modules pipeline |
| Duplicate rules | No | Merging needs a full AST-based optimiser |
Frequently Asked Questions
How much can I expect to save?
Typical hand-written CSS shrinks 25-40% with whitespace minification alone. After gzip, the wire savings are smaller because gzip is already very good at compressing repeated whitespace, but minified CSS still wins on initial parse time and the bytes the browser holds in memory. Brotli adds another 10-20% on top of gzip for the same payload.
Will minification break my CSS?
The patterns this tool uses are conservative: it only strips whitespace around safe characters ({ } : ; , > + ~), removes comments, and trims trailing semicolons. It will not rename selectors, merge rules, or rewrite values. If you use unusual content like data: URIs in url() or content strings with whitespace inside double quotes, paste a small sample first and verify the output matches what you intended.
Can I un-minify CSS?
Not back to your original formatting, but you can prettify minified CSS using any code formatter like Prettier or VS Code's built-in formatter. Indentation, line breaks, and spacing are all stylistic choices, so a re-formatted version will look clean but won't match your original style guide unless you reapply your formatter config.
Should I minify in development?
No. Source maps and readable line numbers are essential for debugging. Most build tools only minify the production bundle and leave development output unminified. Browser DevTools also pretty-print minified CSS on the fly, but stack traces still point to the wrong lines without source maps. Keep your dev experience verbose; let the build pipeline handle the squeeze.
Does the order of declarations change?
No. Whitespace minification preserves the original source order of every selector, every property, and every value. This matters because CSS specificity and source order both contribute to the cascade; reordering rules can change which value wins on an element. AST-based tools like cssnano sometimes reorder properties within a single rule (when safe) to improve gzip compression, but this tool does not.
Related Tools
JavaScript Minifier
Minify JavaScript by removing comments and collapsing whitespace. See compression statistics with original and minified size comparison.
HTML Entity Encoder
Encode text to HTML entities or decode entities back to text. Handles named, numeric and hex entities. Bulk text support with instant copy to clipboard.
JSON Formatter & Validator
Format, minify and validate JSON with syntax highlighting. Shows error locations, key count, nesting depth and size stats