JavaScript Minifier
Compress JS with variable mangling and dead-code elimination. Client-side, nothing is sent to a server.
Why minify JavaScript?
JavaScript compresses further than CSS or HTML because there is more to work with: local variable and function names can be shortened to a single letter without changing behavior, unreachable branches can be deleted outright, and constants can be inlined at their use site. That combination routinely cuts 30-60% off real-world code.
How this minifier works
This tool runs terser in your browser. Unlike a whitespace-only minifier, terser parses your code into an AST (an actual syntax tree, not text), which is what lets it safely rename local variables, remove code paths that can never execute, and fold constant expressions.
Because it needs a real, parseable AST, input must be plain JavaScript. TypeScript type annotations and JSX will fail to parse — strip them first (or run your build's transpile step) before pasting code in here.
Before deploying minified JS
Keep the original source under version control and generate a source map in your real build so browser DevTools can map a minified stack trace back to readable line numbers.
Every major bundler (Vite, webpack, Rollup, esbuild) minifies JavaScript automatically in production mode, usually with terser or a similar tool under the hood. Use this page to check a single file or snippet quickly; let the bundler handle a full project.