🗜️ CSS Minifier
Paste your CSS and minify it instantly — comments are stripped, whitespace collapsed, and strings plus url() values are kept intact. See exactly how many bytes you save.
About
This CSS minifier runs entirely in your browser using a tokenization approach that correctly handles edge cases. It strips single-line (//) and multi-line (/* */) comments, collapses sequences of whitespace to a single space or removes them around punctuation such as { } : ; , and >, and preserves the content of quoted strings and url() values so that spaces inside data URIs or font names are never corrupted. Because it is a basic tokenizer rather than a full AST parser, it is fast and dependency-free, suitable for the vast majority of hand-written or preprocessor-generated CSS. The tool displays the original size, minified size, and bytes saved so you can make an informed decision about whether further optimization is needed.
How to use
- Paste your CSS into the input area on the left.
- Click Minify — the tool tokenizes your CSS and outputs a compressed version on the right.
- Check the size summary to see the original size, minified size, and how many bytes were saved.
- Click Copy to copy the minified CSS to your clipboard, or use Download to save it as a .css file.
FAQ
- Does this tool process my CSS on a server?
- No. Minification runs entirely in your browser with JavaScript. Your CSS is never sent anywhere.
- Will minification break my CSS?
- The tokenizer protects quoted strings and url() values, so valid CSS should survive intact. However, this is not a full AST parser — unusual edge cases in non-standard syntax may not be handled perfectly.
- Are single-line // comments removed?
- Yes. Both // single-line and /* */ multi-line comments are stripped. Note that // is not officially part of the CSS spec but is common in preprocessor source files.
- How much smaller will my CSS get?
- Typical hand-written CSS shrinks by 20–40%. Files with many comments or generous whitespace save more. For maximum compression, pair this with gzip or Brotli on your server.
- Can I minify CSS with variables or calc() expressions?
- Yes. Custom properties (--var), var(), calc(), and other modern CSS functions are treated as regular token values and pass through safely.