CSS Minifier
Clean CSS comments and redundant whitespace
Paste CSS first to minify it and inspect output length immediately; compatibility and minification strategy notes are available in Advanced mode.
The full guide also includes pitfalls, worked examples, snippets, FAQs, and related tools for checking results or troubleshooting.
About this tool
Apply lightweight CSS comment and whitespace cleanup with quoted-string and escape protection. Token spacing is retained, and a basic brace check catches obvious imbalance. This tool does not perform rule optimization, full syntax validation, browser targeting, or source-map generation.
Production Snippets
Example
text
content: "a b";
width: calc(100% + 1px);Scenario Recipes
Inspect protected content and math spacing
Goal: Reduce whitespace while checking values that must retain it.
- Paste .x { content: "a b"; width: calc(100% + 1px); }.
- Confirm the quoted double space and spaces around + remain.
- Choose whether to retain /*! license comments */ and inspect the destination rendering.
Result: The output is lightweight text cleanup; no shorthand merge or source map is generated.
Failure Clinic (Common Pitfalls)
A brace check is not complete CSS validation
Cause: The scanner preserves quoted tokens and escapes but does not parse every CSS or preprocessor construct.
Fix: Run the projectβs actual parser/linter and browser checks for release bundles.
Frequently Asked Questions
Which transformations are performed?
The tool collapses ordinary whitespace outside quoted strings, removes ordinary comments where possible, and optionally keeps /*! comments */. It preserves token-separating spaces and may keep an empty comment between adjacent tokens. It does not merge rules, rewrite shorthand, remove prefixes, or generate source maps.
Are strings and calc() spaces preserved?
Quoted strings and escaped characters are protected before cleanup. Spaces around math operators are retained, so calc(100% + 1px) keeps the spacing CSS requires. These protections do not make the tool a full CSS parser; unusual syntax and preprocessors still need their own build tools.
Does the brace check validate the stylesheet?
No. It checks brace balance and order outside protected tokens, which catches some obvious errors. It does not validate property names, selector grammar, browser support or every unclosed token. Use a CSS parser or linter and render tests for production bundles.
What does the saved size mean?
It compares uncompressed UTF-8 input and output bytes. It is not a measured network saving or performance result. Keep readable source separately, and preserve license comments required by your project.
Keep browsing