What is the JavaScript Minifier?
Terser is the minifier behind most modern JavaScript build tools. This page runs it in your browser: remove whitespace, compress code and shorten variable names (mangle) for the smallest result.
Features
Compress
Removes dead code and simplifies expressions.
Mangle
Shortens local variable names.
Savings shown
Before and after sizes.
How to use the JavaScript Minifier
- 1
Paste your JavaScript.
- 2
Pick the options.
- 3
Copy the minified code.
Who it is for
Small projects
Minify a script without setting up a build tool.
Tips for better results
- Errors in your code stop minification. The message shows the line to fix.
- Keep the original file for editing.
Questions people ask
Does it support modern JavaScript?
Yes, Terser understands modern syntax.
Will my code still work?
Yes, Terser keeps behaviour the same. Keep a copy of the original for editing.