JS / CSS Minifier
This minifier shrinks JavaScript or CSS by stripping comments and collapsing whitespace, and shows the original size, minified size and percentage saved.
About this tool
This minifier shrinks JavaScript or CSS by stripping comments and collapsing whitespace, and shows the original size, minified size and percentage saved.
How to use it
- Choose JavaScript or CSS.
- Paste your code into the input box.
- Click Minify and check the size savings.
- Copy the minified output.
Good to know
- For JavaScript it removes // and /* */ comments, collapses whitespace and trims spaces around operators, while skipping string literals.
- For CSS it strips comments, collapses whitespace and removes spaces around : { } ; and , characters.
- It does not rename variables or rewrite code, so savings are smaller than with bundlers like Terser or esbuild.
- Minified files load faster because fewer bytes travel over the network.
Runs entirely in your browser — nothing you enter is uploaded or stored.
Frequently asked questions
Is this minifier safe for production code?
It is fine for quick, private minification. For production builds, a full tool like Terser or esbuild adds renaming and dead-code removal and handles every edge case.
Will minifying break my JavaScript?
Whitespace minification is usually safe, but code that relies on automatic semicolon insertion across line breaks can break. Test the output.
Is my code uploaded to a server?
No. Minification runs entirely in your browser.
How much smaller will my files get?
It depends on how many comments and how much whitespace the code has; the tool shows the exact percentage saved.