Code Minifier
Minify CSS, JavaScript, or HTML by safely stripping comments and collapsing whitespace.
How to use the Code Minifier
- Choose CSS, JavaScript, or HTML from the language dropdown.
- Paste your code and click "Minify".
- Copy the compressed output, and check the character-count savings shown below it.
Why use this tool
Smaller CSS, JS, and HTML files transfer faster and reduce bandwidth. This is a lightweight, safe minifier — it strips comments and collapses whitespace without renaming variables, reordering code, or making risky structural changes, so the output stays predictable and easy to debug if something looks off.
Frequently Asked Questions
Is this as aggressive as Terser or cssnano?
No. Dedicated build-tool minifiers also rename variables, remove dead code, and apply many other optimizations. This tool focuses on safe, simple whitespace and comment removal, which is lower-risk for a quick one-off job.
Is minified JavaScript safe from breaking due to missing semicolons?
This minifier preserves line breaks for JavaScript specifically to avoid automatic-semicolon-insertion hazards, at the cost of slightly less compression than a full minifier.