CSS and JS Minifier
Remove comments and unnecessary whitespace from CSS or JavaScript snippets instantly.
Paste CSS or JavaScript to generate a smaller version immediately. This tool is designed for quick cleanup and compact snippets, not deceptive shortcuts or fake progress states.
60
Original chars
44
Minified chars
Approximate characters saved: 16
Minified output
.card{padding:16px;margin:0 auto;color:#222}Recent history
Saved minified snippets will appear here.
Last updated:
Minify CSS or JavaScript snippets
This JS and CSS minifier makes a code snippet smaller by removing comments and extra whitespace. It is a lightweight tool for quick jobs, such as shrinking an embed or a demo, not a replacement for a full build tool like a bundler or compressor.
How to use it
- Choose CSS or JavaScript mode.
- Paste your code into the Source code box. The minified output updates as you type.
- Compare the original and minified character counts and the characters saved.
- Click Copy output to copy the result.
What the minifier removes
CSS mode
- Removes
/* ... */comments. - Collapses all whitespace to single spaces, then removes spaces around
{ } : ; , > + ~. - Drops the last semicolon before a closing brace.
JavaScript mode
- Removes
/* ... */comments and lines that start with//. - Collapses whitespace and removes spaces around brackets, operators and punctuation.
Example in CSS mode:
.card {
padding: 16px;
margin: 0 auto;
}
becomes .card{padding:16px;margin:0 auto}.
Limitations to check before using the output
- The tool uses simple text patterns, not a code parser. It does not rename variables or shorten values.
- In JavaScript, a
//comment at the end of a line of code is not removed. Because line breaks are removed too, it can comment out the code after it. - Code that relies on line breaks instead of semicolons may break once lines are joined.
- Spaces inside strings and template literals are also collapsed.
- In CSS, spaces around
+are removed, which breakscalc()expressions such ascalc(100% + 10px).
Always test the minified code before using it.
Frequently asked questions
Is my code uploaded?
No. Minifying runs in your browser. The optional Save to history button keeps recent snippets in this browser only (local storage), on your own device.
Can I use it for production builds?
For large apps, use your normal build pipeline. This tool is best for short snippets and quick tests.
Related Developer Tools
Browse all tools from the same category.
Domain Authority Checker
Check Moz authority, page authority, spam score, and backlink metrics
Open toolSEO Audit Tool
Audit a website URL for technical SEO, metadata, headings, broken internal links, hreflang, canonical and X-Robots-Tag checks, with report exports
Open toolShowing 1-2 of 49