JavaScript Minifier
- Free forever
- No sign-up
- Runs in your browser
Minify JavaScript with Terser: shorter names, no comments or spaces, and dead code removed. Works with modern JS.
About JavaScript Minifier
Prepares JavaScript for production with Terser, the minifier used inside many build tools. It removes comments and spaces, shortens local variable names and, with Compress on, drops dead code and simplifies expressions over two passes. Modern syntax is understood, ES modules can be minified with the ES module option, and licence comments can be kept so legal notices survive.
How to use JavaScript Minifier
- Paste your code into the Your JavaScript box.
- Keep Compress and Shorten variable names ticked; tick ES module if the code uses import or export.
- Click Minify JavaScript and check the Original, Minified and Smaller figures.
- Test the result, then click Copy or Download .js to save it as script.min.js.
How your data is handled
Terser runs in your browser, loaded from our own site the first time, so your code isn't uploaded, run or stored.
Limits and accuracy
- No source map is produced, so errors in the minified file point to one long line.
- Code that relies on function or class names, such as constructor.name, may break when names are shortened.
- Minifying doesn't hide your code; anyone can reformat it, so never put secrets in browser JavaScript.
Questions and answers
When should I tick Also shorten top-level names?
Only when nothing outside the file calls its global functions or variables by name. Otherwise another script, or an onclick in your HTML, may stop working.
Does it support TypeScript or JSX?
No. Terser reads plain JavaScript, including modern syntax, but not TypeScript types or JSX tags. Compile those to JavaScript first, then minify the output here.
Is my code uploaded?
No. Terser runs in your browser, so your code isn't sent to SAA Tool. Always test the minified file before you publish it.
Do I need to sign up?
No. JavaScript Minifier is free with no sign-up, no login and no daily limit, and there's nothing to install. It works on a phone as well as a PC.
Does it change variable names?
Yes, local variable names are shortened (that's where most of the saving comes from), but global names and exports stay the same so your code keeps working. Keep the original file for editing.