Runs 100% in your browser — nothing is uploaded
Formatters & Minifiers

JavaScript Minifier

Compress and mangle JavaScript with terser — the same minifier used by Webpack and Vite — right in your browser.

JavaScript Minifier
Client-side

About this tool

The JavaScript Minifier compresses JavaScript using terser, the industry-standard minifier that powers the production builds of Webpack, Vite, Rollup, and esbuild's optional terser mode. Paste readable source code and get back a compact, functionally identical version with dead code eliminated, expressions simplified, and (optionally) identifiers shortened.

Three toggles control the output: Compress applies terser's expression-level optimizations (constant folding, dead code removal, conditional simplification). Mangle renames local variables and function parameters to short single- or two-character names, which is usually the single biggest source of size reduction. Source map generates an inline source map so the minified output can still be debugged back to original line numbers in browser DevTools.

Because terser performs a real parse of your code, minification is not instantaneous — it runs asynchronously, and the tool shows a loading state while it works. This also means genuinely invalid JavaScript is caught: if your input has a syntax error, terser's parser reports it with the exact line and column, which is surfaced directly as the error message rather than a generic failure.

A "Saved X% · A KB → B KB" summary shows the exact byte reduction after each run. Nothing is uploaded — terser runs as a pure-JS library loaded into your browser tab, so your source code never leaves your machine. This is particularly relevant for minifying pre-release or proprietary code you don't want passing through a third-party server.

FAQ

Why is minification not instant like other tools here?
Terser performs a full parse, AST transformation, and code generation pass — the same work a production build tool does. For larger inputs this takes measurable time, so this tool uses an explicit Run button and a loading indicator instead of live-as-you-type minification.
What does "Mangle" actually do?
Mangling renames local variables and function parameters to the shortest possible unique names (a, b, c, ...) within their scope. It does not rename global variables or object property names, since that would break the code.
Why does the tool show a line and column in the error?
Terser is a real JavaScript parser — when your input has a syntax error, it cannot be minified at all, and terser reports exactly where the parser failed. That location is shown as-is in the error field, the same message you would see running terser from the command line.
Is the source map safe to ship to production?
Source maps make your original (pre-minification) code and variable names visible to anyone who opens DevTools with the map loaded. Ship them to your error-tracking service or an internal-only path, not a public CDN, unless you intend the original source to be publicly inspectable.
How much smaller will my code get?
It depends on the source: code with long, un-mangled variable names and no dead code might shrink 40-60% with both Compress and Mangle enabled. Already-minified code will see little additional reduction. The savings pill after each run shows the exact number for your input.