JavaScript Minifier
Safely strip comments and extra whitespace from your JavaScript to reduce file size — without the risk of breaking your code.
Why this minifier is deliberately conservative
Aggressive JavaScript minifiers rename variables and collapse everything onto one line to squeeze out maximum savings. Done wrong, this can silently break code — especially around edge cases in how JavaScript automatically inserts semicolons.
This tool takes a safer approach: it correctly tracks strings, template literals and regex patterns so it never strips something that looks like a comment but isn't, and it only removes things that are unambiguously safe to remove — comments, blank lines, and trailing whitespace.
Frequently asked questions
Why doesn't this rename variables like other minifiers?
Variable renaming needs a full understanding of your code's scope to do safely — get it wrong and you break the script. For a general-purpose tool used on all kinds of code, we'd rather guarantee correctness than chase maximum compression.
Will this break my code?
It's designed not to — string contents, template literals, and regex patterns are correctly preserved untouched. Comments and unnecessary whitespace are the only things removed.
Is my code uploaded anywhere?
No — minification happens entirely in your browser. Nothing you paste here is sent to our servers.