> js | minify | terser <

// Compress, shrink, and optimize JavaScript with Terser to ship smaller bundles

[TERSER]

Industry-Standard Engine

Powered by Terser, the same minifier used by webpack, Rollup, Vite, and most modern JavaScript build tools. Conforms to ECMA-262 (ECMAScript) parsing rules.

[MANGLE]

Optional Name Mangling

Toggle variable name mangling and dead-code elimination separately. Disable mangling when you need readable stack traces during debugging.

[STATS]

Real Savings Numbers

See original size, minified size, percentage saved, and a visual compression ratio bar. 100% client-side, browser-based, your code is never uploaded.

// ABOUT JS MINIFICATION

How JS Minification Works:

Terser parses your JavaScript into an AST per the ECMA-262 (ECMAScript) specification, applies safe transformations like dead-code elimination, constant folding, conditional hoisting, and whitespace removal, then optionally renames identifiers via mangling to single-character names. See the Terser docs for the full set of compression and mangling options. The result is functionally identical, just smaller.

Example:

function add(a, b) { return a + b; } -> function add(n,d){return n+d}

Common Use Cases:

  • >Shipping production JS bundles
  • >Inlining helper scripts in HTML
  • >Reducing bandwidth for end users
  • >Improving Time to Interactive (TTI)
  • >Lightweight obfuscation of client logic

>> frequently asked questions

Q: Is my code uploaded anywhere?

A: No, this minifier is fully browser-based and runs entirely client-side. Terser is loaded as a CDN library and executes inside your browser tab. Your JavaScript source never leaves your machine, is not logged, and is not transmitted to any server. The tool works offline once the page has loaded the Terser bundle.

Q: What does mangling variable names do?

A: When enabled, Terser renames local variables, parameters, and (optionally) properties to short identifiers like a, b, c following safe ECMA-262 scope rules. This produces noticeably smaller output but makes stack traces and runtime debugging harder. Disable it for shippable bundles where you want to keep useful function and variable names in error reports.

Q: Does this support modern JS (ES2020+)?

A: Yes. Terser supports modern syntax defined by recent ECMA-262 editions including optional chaining, nullish coalescing, async and await, classes, modules, top-level await, private fields, and BigInt literals. It will not transpile down to older targets, only minify; pre-transpile with Babel or SWC if you need legacy browser support, then minify the output here.

Q: Why did my code error on minification?

A: Terser strictly parses the input per ECMA-262. Common causes are syntax errors, mixing module-level top-level await with non-module syntax, pasting partial expressions, or feeding TypeScript or JSX directly. The exact error from Terser is shown in the error panel above the output, including line and column information when available.

Q: Is the output safe to ship to production?

A: Terser is the same minifier used by major bundlers like webpack, Rollup, and Vite in production builds today. For best results, run it on already-transpiled JavaScript that targets the browsers you support, and run your full test suite against the minified output before deploying. The Terser docs cover edge-case flags worth tuning.

// OTHER LANGUAGES