CSS Minifier

Minify CSS with CSSO: removes whitespace and comments, shortens colors and values and merges rules safely. Shows the bytes saved. Free, runs in your browser.

Output

Runs entirely in your browser. Your data is never uploaded.

Related Tools

View All

What is CSS Minifier?

The CSS Minifier compresses stylesheets with CSSO, a structural optimizer. Besides removing whitespace and comments it shortens values (#ff0000 → red, 0px → 0), merges duplicate rules and removes redundant declarations where this cannot change the result.

How to use CSS Minifier

  1. Paste your CSS into the input box.
  2. Click Minify (the output also updates while you type).
  3. Check the size line for the saving.
  4. Copy or download the minified CSS.

Example

Input
a { color: #ff0000; margin: 0px 0px; } /* c */
Output
a{color:red;margin:0}

When to use CSS Minifier

Use it for production builds of small sites, inline <style> blocks or CSS stored in a CMS. If your build already uses a bundler with cssnano/lightningcss, keep using that. Keep license comments manually if your licence requires them.

How CSS Minifier works

First a quick scan checks braces, strings and comments and reports unbalanced blocks with their position. The CSS is then passed to csso.minify with restructuring enabled: CSSO parses it into an AST (css-tree), applies safe value compressions and rule merging, and prints the result without whitespace. Comments are removed, including /*! … */ license comments.

Common Use Cases

  • Minifying a standalone stylesheet for a landing page
  • Shrinking critical CSS before inlining
  • Compressing CSS stored in a database or CMS
  • Comparing optimised size against the original

Security Note

Everything runs locally in your browser; the code you paste is not uploaded.

FAQs

Can minification break my CSS?

CSSO only applies transformations that keep the cascade result the same, but always test the output.

Why did #ff0000 become red?

red is shorter and means exactly the same colour.

Are license comments kept?

No, all comments are removed. Add the license back manually if required.

Good next steps

Explore more categories