JavaScript Minifier / Beautifier
Minify JavaScript with Terser (the engine in webpack and Next.js). Variable mangling, dead-code elimination, drop console. Beautify mode included.
tuneMinification Preset
What is the JavaScript Minifier / Beautifier?
A JavaScript minifier transforms readable code into the smallest valid form a browser can still execute, then ships fewer bytes. The serious work isn't whitespace removal; it's renaming local variables to single letters (mangling), removing dead code, and inlining values. Terser, the engine here, is what webpack, Next.js, Vite, and Rollup use under the hood for production builds.
How to use the JavaScript Minifier / Beautifier
- 1
Paste or upload your JS
Drop JavaScript into the input pane, drag a .js file in, or click Upload. Load Sample drops in an example. Files up to 5 MB.
- 2
Pick a preset
Safe (whitespace and comments only), Standard (mangle variables, drop debugger, 2 passes), or Aggressive (everything plus drop console.log, 3 passes).
- 3
Or open Advanced Options
Toggle individual flags: remove comments, mangle variables, drop console.*, drop debugger, and the number of compress passes (1 to 3).
- 4
Click Minify and download
Output appears below with savings stats. Copy to clipboard or download as <name>.min.js. Beautify mode reverses for unminifying.
Frequently Asked Questions
What engine does this use?
Terser, the production-grade JavaScript minifier that powers webpack, Next.js, Vite, and Rollup builds. Same library, same options, just running locally in your browser instead of in a build pipeline.
What are the preset options?
Three. Safe strips comments and whitespace only (no risk of breaking anything). Standard adds variable mangling, dead-code elimination, and 2 compress passes (the typical production config). Aggressive adds drop console.log and a third compress pass for maximum compression. The Advanced Options panel lets you mix and match individual flags.
Does it support modern JavaScript?
Yes. Terser parses everything ECMAScript shipped through ES2022: arrow functions, classes, async/await, template literals, optional chaining, nullish coalescing, BigInt, dynamic imports. TypeScript syntax (.ts, .jsx, .tsx) is accepted but treated as JavaScript, so type annotations need to be stripped first if you want clean output.
Can I unminify JavaScript?
Yes. Click Beautify and Terser reformats the code with line breaks and indentation (2 spaces, 4 spaces, or tab). The output isn't a perfect reverse of minification: variable names that were mangled stay mangled (a, b, c instead of the original names), since the original names aren't in the file anymore.
What does variable mangling do?
Renames local variables to single letters (a, b, c...) to shave bytes. Mangling only touches names that are safe to rename: function parameters, locally-declared variables. Globals, exported names, and object property names stay intact, since renaming them would break references from the outside world.