About the JavaScript Minifier
Minification happens in two stages. Compress rewrites code into shorter equivalent forms: it removes unreachable code (such as if (DEBUG) blocks when DEBUG is a constant false), inlines constants, joins declarations and turns if statements into conditional expressions. Mangle names shortens local variable and function names to one or two letters. Together they typically cut source size by 50–70% before gzip.
ES module parses the input as a module (strict mode, import/export allowed) — leave it on for modern code and turn it off for classic scripts. Mangle top-level also renames top-level functions and variables; only use it for self-contained bundles, because other scripts may reference those globals. Drop console.* removes console.log and friends. Keep /*! license */ comments preserves comments starting with /*! or containing @license or @preserve.
The status line compares the original, minified and gzip-compressed sizes. Syntax errors are reported with line and column. This page does not generate source maps; for production builds use Terser through your bundler so you get maps for debugging. The minifier runs locally in your browser after a one-time download of the library.
How to use it
- Paste JavaScript or open a .js file.
- Choose compress, mangle and module options.
- Check the size savings in the status line.
- Copy the output or download script.min.js.
Frequently asked questions
What is the difference between minification and obfuscation?
Why did my code break after minifying?
fn.name, constructor.name) that mangling changes, or top-level names are referenced from other scripts. Untick Mangle top-level or Mangle names to confirm.