JavaScript Minifier
Shrink JavaScript for production with Terser — the same minifier used by webpack, Vite and Next.js. See exactly how many bytes you save, before and after gzip.
Runs in your browser — nothing is uploaded Free, no limits
JavaScript input
Minified
How to use the JS Minifier
- Paste your JavaScript, open a .js file or load the sample.
- Choose options: mangle names, compress, keep /*! license */ comments, ES module.
- Check the size, saving and gzip numbers — or the error's line and column if the code doesn't parse.
- Copy the minified code or download it as a .min.js file.
Frequently asked questions
What does a JavaScript minifier do?
It removes whitespace and comments, shortens local variable names (mangling) and rewrites code into shorter equivalent forms, such as removing unreachable branches. The behavior stays the same but the file downloads and parses faster.
Is minified JavaScript safe to use?
Yes, Terser preserves the meaning of valid code. Code that relies on function or class names at runtime (for example fn.name) can be affected by mangling, so turn mangling off if you depend on names.
What does the ES module option do?
It parses the input as a module, so import and export statements are allowed and strict mode is assumed. It also lets Terser rename top-level names, because module scope isn't global.
Why keep /*! comments?
By convention, comments starting with /*! (and those with @license or @preserve) hold license notices that many open-source licenses require you to keep. The option keeps those and removes everything else.
Should I still enable gzip or Brotli on my server?
Yes. Minification and compression work together: minifying removes redundancy that compression can't, and gzip or Brotli then shrinks the result further. The gzip estimate shows the size actually sent over the network.
Is my code uploaded?
No. Terser runs inside your browser, so your source code never leaves your device.