CSS Minify
Minify CSS: remove comments, spaces and the last semicolon in each rule, while keeping strings, url() values and meaningful selector spaces intact. Runs in your browser.
Suggested tools
About CSS Minify
CSS Minifier makes stylesheets smaller by removing comments, line breaks and unnecessary spaces, and the last semicolon in each rule. Smaller CSS downloads faster, which helps page speed and Core Web Vitals.
It is careful about the places where spaces matter: text inside quotes, url(...) values and descendant selectors such as "div :first-child" are left intact, so the minified CSS behaves exactly like the original. Everything runs locally in your browser — the text you paste is never uploaded.
How to use CSS Minify
- Paste your CSS or upload a .css file.
- Press Minify.
- Copy the one-line result or download it, and use it in production.
Key features
- Removes comments and redundant whitespace
- Keeps strings and url() values untouched
- Preserves meaningful spaces in selectors
- Drops the final semicolon in each block
Example
/* buttons */
.btn {
color: #fff;
margin: 0 auto;
}
.btn{color:#fff;margin:0 auto}When to use CSS Minify
- Shrinking a stylesheet before uploading it to a website without a build tool.
- Compacting CSS for inline <style> blocks in emails or landing pages.
- Reducing CSS size to improve page-speed scores.
Tips and common problems
- Minify a copy — comments are removed and cannot be recovered.
- Enable gzip or brotli on your server too; it compresses minified CSS further.
- Test the page after replacing the CSS, especially if it uses unusual hacks.
Frequently asked questions
Typically 15–30% for hand-written CSS, depending on how many comments and how much indentation it had. Gzip on your server then compresses it further.
Yes — paste the minified CSS into CSS Formatter and press Beautify. Comments that were removed cannot be restored, so keep your source file.
No. It only removes characters that have no effect. It never renames, reorders or merges rules.