Compress and mangle
Terser is the minifier behind webpack, Vite and many other build tools. Compress rewrites code into shorter equivalents — removing dead code, folding constants, joining variable declarations and simplifying conditions. Mangle renames local variables and function parameters to one or two letters. Together they typically shrink JavaScript by 50–70% before gzip. Global names and object properties are never renamed, so your public API keeps working.
Options explained
- ES module — tick for code with
import/export; enables top-level mangling safely. - Remove console — drops
console.logand friends from production builds. - Keep licence comments — preserves
/*! … */banners required by many licences.
Minified code is hard to debug — keep your source and use the JavaScript Formatter to read minified code.
Everything runs in your browser — your code and data are never uploaded, so it is safe to paste private config files and API responses.
Frequently asked questions
Does it support modern JavaScript?
Yes — ES2015+ syntax including classes, async/await, optional chaining and modules.
Can minified code break?
Rarely; code that relies on function.name or eval of local variables can be affected by mangling — turn mangling off then.
Does it handle TypeScript?
No, compile TypeScript to JavaScript first.
Last updated 2026-11-21 · Built by Vinayak Agarwal · Part of Developer & Web (77 tools)