CSS Minifier
Free online CSS minifier. Compress and minify CSS by removing comments and collapsing whitespace - smaller stylesheets, faster page loads. Runs in your browser, no upload required.
About CSS Minifier
Minify CSS instantly in your browser. Paste your stylesheet to strip comments, collapse whitespace, and tighten the spacing around braces, colons, and semicolons - producing a smaller CSS file that downloads and applies faster. The minifier protects the contents of your strings (like content values and url() paths) and preserves the spacing CSS actually needs, such as inside calc() expressions and media queries, so your styles keep working exactly as before. It shows precisely how many bytes you saved, and everything runs client-side, so your CSS never leaves your device.
How to Use CSS Minifier
- Paste or type your CSS into the input box.
- Click Minify CSS to remove comments and collapse extra whitespace.
- Review the bytes saved and the percentage reduction shown above the output.
- Click Copy to grab the minified CSS for your project or build pipeline.
CSS Minifier Examples
Collapse whitespace and tighten rules
A formatted rule like .box {\n margin: 0 auto;\n color: #333;\n} becomes .box{margin:0 auto;color:#333} - smaller and identical when applied.
Remove comments
Developer comments such as /* main layout */ are stripped from the output, while text inside strings and url() values is preserved.
Preserve calc() and media queries
Spacing that CSS requires - like calc(100% - 20px) and @media screen and (min-width: 900px) - is kept intact so your styles never break.
Read the full guide
How to Use CSS Minifier: Complete Guide (2026) - 5 min read
Frequently Asked Questions about CSS Minifier
- What does a CSS minifier do?
- A CSS minifier reduces the size of a stylesheet without changing how it styles your page. It removes the characters browsers ignore - comments, line breaks, indentation, and repeated spaces - and tightens the spacing around braces, colons, semicolons, and combinators. The rendered page looks identical, but the file is lighter and downloads faster.
- Does minifying CSS change how my site looks?
- No. Minification only removes characters that do not affect the result - whitespace and comments - and safely tightens punctuation. Declarations, selectors, and values are untouched. This tool also preserves the spacing CSS genuinely needs, such as inside calc() and between the parts of a media query, so nothing breaks.
- Is my CSS uploaded to a server?
- No. All minification happens entirely in your browser using JavaScript. Your CSS is never sent to or stored on a server, which makes the tool safe for private stylesheets, design systems, and unreleased themes.
- Why should I minify CSS?
- Smaller CSS files transfer faster and block rendering for less time, which improves page load speed and Core Web Vitals - especially on mobile and high-traffic pages. Minified CSS also lowers bandwidth costs. Keep a readable, formatted version in your source code and minify as part of your build or before deploying.
- How much smaller will my CSS be?
- It depends on how much whitespace and how many comments your stylesheet contains. Heavily formatted, well-commented CSS often shrinks by 20-40%, while already-compact CSS saves less. The tool shows the exact bytes saved and the percentage reduction so you can see the result for your specific file.
- Will it break calc(), custom properties, or url() paths?
- No. This is a safe minifier: it protects the contents of quoted strings and url() values, keeps the spaces that calc() requires around + and -, and preserves the space before the parenthesis in media queries. It focuses on the reductions that are always safe rather than aggressive rewrites that can break edge cases.
- Should I minify CSS or just use gzip/Brotli?
- Use both. Server compression (gzip or Brotli) already handles repeated whitespace well, so the over-the-wire difference from minifying alone is smaller than the raw byte saving. Minifying still helps: it shrinks the uncompressed size in caches and memory, gives the compressor less to do, and guarantees a smaller file even where compression is unavailable.