JavaScript Minifier
Your text never leaves your browser — everything runs on your device.
Paste JavaScript and shrink it: comments are stripped and whitespace is collapsed, with the size before and after shown. This minifier is deliberately conservative — string literals, template literals and regular expressions are left completely untouched, newlines are preserved so automatic semicolon insertion cannot change your code, and spaces around + and - are kept. Free, no signup, and your code never leaves your browser.
Frequently asked questions
Is the minified code guaranteed to work the same?
This minifier only removes comments and collapses whitespace, and it never touches strings, template literals or regular expressions. Newlines are preserved, so automatic semicolon insertion behaves exactly as in the original. That said, always test minified code before shipping it.
Why is this minifier "conservative"?
Aggressive minifiers rename variables and rewrite expressions, which can break code that relies on specific names or edge-case behaviour. This tool only does the safe part — removing comments and whitespace — and says so plainly instead of risking subtle breakage.
How much smaller will my JavaScript get?
Typical savings are 10–30% for commented, well-formatted code. Code that is already compact saves less. The tool shows the exact before and after sizes for your file.
Is my code uploaded anywhere?
No. Minification runs entirely in your browser. Nothing you paste is sent to a server or stored.