Home › Minifiers & Beautifiers › JavaScript Minifier
JavaScript Minifier
Remove comments and unnecessary whitespace from JavaScript. The minifier works from a real token stream, so strings and regular expressions are never damaged.
How to use the JavaScript Minifier
- Paste your JavaScript into the input box.
- Press Minify.
- Compare the size, then copy or download the minified code.
- Test the minified file in your project before shipping it, as with any minifier.
About this tool
This minifier is deliberately conservative. It tokenizes your code first — understanding strings, template literals, regex literals and comments — and only removes whitespace it can prove is safe. Line breaks that automatic semicolon insertion depends on (for example after return) are preserved, and license comments starting with /*! are kept. It does not rename variables or rewrite your code, so the output stays recognisably yours and safe to debug.