JavaScript Minifier
Compress and mangle JavaScript with terser — the same minifier used by Webpack and Vite — right in your browser.
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.
