JavaScript Minifier

Terser in your browser. Live output, per-option control, real byte-savings stats.

Minification in your browser. Paste JavaScript, get minified output. Terser under the hood; nothing sent to a server. How to use ↓·Shortcuts ↓
Paste JavaScript, get minified output. Terser under the hood.
Comments:Target:
Samples:
JavaScript Input
Minified Output
Minified output will appear here.
Input: 0 bytesOutput: 0 bytesSaved: 0 bytes · 0%

How to use

Paste JavaScript into the input pane. The minified output appears on the right as you type (300ms debounce, so it doesn't re-run on every keystroke).

Adjust the options row to control mangling, compression, comment preservation, and ECMAScript target. Copy the output or download as minified.js.

Keyboard shortcuts

Two shortcuts:

Cmd / Ctrl + KFocus the input pane
Cmd / Ctrl + EnterCopy output to clipboard

When to use it

Minification is production shipping. It strips whitespace, shortens variable names, drops comments and dead code, and can remove debugging aids like console.log and debugger.

  • Preparing a script for a static site or CDN drop, without setting up a build pipeline.
  • Quickly checking how small a snippet gets before wiring it into a bundler.
  • Sanity-checking terser's output on a specific piece of code.
  • One-off scripts that don't warrant a full build.

When not to use: If you already have a build pipeline (webpack, Rollup, Vite, esbuild), minify there — you'll want source maps and integration into your deploy.

Options

Mangle names — renames variables and function names to short forms (a, b, c, ...) within their scope. Safe by default; can break if your code relies on Function.prototype.name or reflection.

Compress — enables terser's expression-level optimizations: dead code elimination, constant folding, inline simple functions, remove unreachable branches.

Drop console — removes all console.* calls. Only active when Compress is on.

Drop debugger — removes all debugger; statements. Only active when Compress is on.

CommentsNone strips every comment. Important keeps /*! */-style banners (license headers). All keeps every comment.

Target — ECMAScript version the output must run on. ES5 for legacy browser support; Latest for modern-only builds.

Format-specific gotchas

Mangling can break code that reads function names. If your code does fn.name === 'handleClick', mangling changes handleClick to something like a. Same for Vue/React devtools that use displayName — pass those through your build unchanged, or disable mangling.

Terser is not a transpiler. Modern syntax stays modern. If you paste in async functions and set target to ES5, terser will not down-compile — you'll get an error or invalid output. Use Babel for down-compilation, then terser to minify.

Long-running scripts may hit the debounce. Minification runs 300ms after your last keystroke. Very large inputs (hundreds of KB) may take a second or two to process on the main thread.

Terser is dynamic-imported on first use. First minify has a small delay while the library loads (~200KB gzipped). Subsequent runs are instant.

Privacy

Everything runs in your browser. Your JavaScript never leaves the page — no server, no logging, no analytics on the content.

Frequently asked questions

What is JavaScript minification?
Minification reduces file size by removing whitespace, comments, and dead code, and shortening variable names. It preserves behavior — the minified script runs identically to the original.
Is this the same as compression like gzip?
No. Minification changes the source itself; compression encodes the bytes during transfer. Use both — minify first, then let the server gzip or brotli the response for best results.
Will minifying break my code?
Rarely, but yes if your code relies on function names or class names as strings (via Function.prototype.name), or on eval strings. Test after minifying, and disable mangling if you hit issues.
Why does the first minify take a moment?
Terser is loaded on demand — the first minify triggers the download (~200KB gzipped). After that, minification is instant.
Does the tool support source maps?
Not in this version. Terser supports source map output; if you need them, run terser as part of your build pipeline instead.
Can I minify a whole bundle?
For anything larger than a few hundred KB, use terser via a bundler — the browser main thread will freeze on massive inputs. This tool is for snippets and small files.