HandyBench

JavaScript Minifier

Shrink JavaScript with real AST-based minification.

How to use the JavaScript Minifier

  1. 1 Paste your JavaScript into the editor.
  2. 2 Toggle mangle (shorten variable names) and compress (remove dead code) as needed.
  3. 3 Click Minify and copy or download the result, along with the bytes saved.

Examples

  • Shrinking a 40 KB bundle before deploying to production.
  • Minifying a small script to paste inline in HTML.

Frequently asked questions

How is this different from a find-and-replace whitespace stripper?

It uses Terser, a real JavaScript parser and AST-based minifier — the same engine used by major build tools. That means it safely renames local variables, drops dead code and removes whitespace without breaking your syntax, unlike naive regex-based minifiers.

What does "mangle" do?

Mangle renames local variables and function parameters to short one- or two-letter names, which shrinks the file further. Disable it if you need to keep readable names for debugging.

What does "compress" do?

Compress applies dead-code elimination and expression simplification (folding constants, dropping unreachable code, shortening conditionals) before the output is printed.

Is my code uploaded anywhere?

No. Terser runs entirely in your browser, so your source code never leaves your device.

What happens if my JavaScript has a syntax error?

Terser reports the parse error with a line and column number so you can fix it — nothing is minified until the code parses successfully.