JavaScript Minifier
Strip comments and unnecessary whitespace from JavaScript.
Runs entirely in your browser.
Minify JavaScript Online
About JavaScript Minifier
This removes comments and the whitespace that carries no meaning, while leaving strings, template literals and regular expressions untouched - it tracks when it is inside one, so a // inside a string is not mistaken for a comment.
It deliberately does not rename variables or restructure code. That is what a full compressor like Terser does, and it needs to parse the whole program to do it safely. This is the safe subset: the output is byte-for-byte equivalent in behaviour, which makes it fine to run on code you do not fully control.
Related Tools
- CSS Minifier — strip comments and whitespace from CSS
- CSS Formatter — beautify CSS back into readable form
- JS Formatter — beautify JavaScript back into readable form