Tools

JavaScript Minifier

Minify and compress JavaScript with Terser

How to minify JavaScript

  1. Paste your JavaScript, including modern syntax such as arrow functions, classes, async/await and optional chaining.
  2. Choose whether to Shorten variable names (mangling), which gives the biggest saving.
  3. Press Minify. The minifier loads on first use, then runs instantly.
  4. Copy the output or download min.js. If your code has a syntax error, the line and column are shown.

Powered by Terser

This page uses Terser, the minifier inside webpack, Vite, Rollup and many other build tools, so the output is production quality. It removes whitespace and comments (keeping @license, @preserve and /*! comments), drops dead code, folds constants, shortens true to !0 and, with mangling on, renames local variables and parameters to single letters. Top-level names and properties are not renamed, so your exported functions keep their names.

A quick online minifier is handy for bookmarklets, inline scripts, snippets pasted into a CMS or tag manager, and small sites without a build step. For larger projects, configure Terser in your bundler instead so source maps are produced.

Your code is minified locally in your browser; only the Terser library is downloaded.

FAQ

Is minified JavaScript secure or obfuscated?

No. Minification makes code smaller and harder to read, but anyone can reformat it. Never rely on it to hide secrets.

Why did my code stop working after minifying?

Code that depends on function or variable names, for example via Function.name or eval, can break with mangling. Untick Shorten variable names.

Does it support TypeScript or JSX?

No. Compile TypeScript or JSX to JavaScript first, then minify the result.