JavaScript Minifier
Remove comments and unneeded whitespace from JavaScript safely, keep license comments, and see the bytes saved.
Loading the tool…
Runs entirely in your browser. Your files and text are never uploaded to our server.
- Instant results
- 100% free
- No sign-up
- Private
JavaScript Minifier makes JS files smaller by removing comments and unneeded spaces, tabs and blank lines. It keeps the line breaks JavaScript relies on, so code behaves exactly the same. It understands strings, template literals, regular expressions and modern syntax, and can keep /*! … */ license comments.
Before and after minifying, the code is syntax-checked (parsed, never run), so you are told about mistakes instead of getting broken output. Variable names are not shortened, which keeps the output readable and safe.
More about JavaScript MinifierHow to use, good to know & FAQ
How to use JavaScript Minifier
- Paste JavaScript or open a .js file.
- Choose whether to keep license comments.
- Click Minify.
- Copy the result or download script.min.js.
Good to know
- Tested on more than 1,500 real-world files: the minified code parses to exactly the same program.
- Typical savings are 15–40%, depending on how many comments and how much indentation the code has. Tools that also rename variables (like Terser) save more, but need a build step.
- ES modules (import/export) are minified too. The syntax check is skipped for them.
Frequently asked questions
Will minified code still work?
Yes. Only comments and whitespace are removed, and line breaks are kept wherever JavaScript’s automatic semicolon rules need them.
Is my code run?
No. It is parsed to check syntax, but never executed, and it never leaves your browser.
Why doesn’t it shorten variable names?
Renaming needs a full understanding of your program and can break code that relies on names. This tool focuses on safe, predictable savings.
When to use JavaScript Minifier
Use it to shrink a script before adding it to a website, a WordPress snippet or an HTML page.
