JS Minifier

Minify JavaScript code to reduce file size.

Minify JavaScript with Terser, the minifier used by most build tools. Whitespace and comments are removed, code is compressed, and local variable names can be shortened. Tick ES module if the code uses import and export. Licence comments (/*!, @license, @preserve) are kept. If the code has a syntax error, you get its line and column instead of broken output. The size saving is shown, and the code never leaves your browser.

Common use cases

  • Minify a small script for a website or a bookmarklet
  • Shrink an embed code or widget
  • Check how small a function can get

How to use

  1. Paste the JavaScript.
  2. Choose whether to shorten names and whether it's a module.
  3. Copy or download the result.

FAQ

Can minified code be turned back?

The layout can, with the JS formatter, but shortened variable names can't be restored. Keep your original source.

Does it support TypeScript?

No. Compile TypeScript to JavaScript first; Terser only reads JavaScript.