Runs 100% in your browser — your code is never uploaded

JavaScript Minifier

Minify and compress modern JavaScript with Terser. It supports ES2024 syntax such as ?., ??=, class fields and #private members. Choose a preset, generate a source map, see the gzip size, or beautify minified code back into a readable layout.

Minify JavaScript

Preset

JavaScript

Drop .js files to load them
Waiting for code

Minified

Your minified JavaScript will appear here.

Loading minifier…

Original

gzip —

Minified

gzip —

Saved

Time

 

Minifier settings

In short: what this JavaScript minifier does

The SeeB4Coding JavaScript Minifier shrinks JavaScript for production using Terser 5, the maintained successor to UglifyJS, and runs entirely in your browser. Paste or drop a file, pick a preset, and copy or download the result. There's no sign-up and nothing is uploaded.

  • Modern syntax: ES2024 support, including optional chaining, ??=, class fields, #private, BigInt, async generators and ES modules.
  • Three presets: Safe, Balanced and Aggressive, plus individual control of compression passes, mangling, top-level scope and comments.
  • Production extras: removes console.* and debugger, keeps /*! license */ comments, and generates .map source maps.
  • Real size numbers: original, minified and gzip size, percentage saved and processing time.
  • Beautify mode: reformats minified JavaScript so it's readable again.
  • Privacy: the minifier runs as client-side JavaScript, and your code never leaves the device.

Last updated: · Engine: Terser 5.51.2

How to minify JavaScript online

Three steps, about a minute.

Add your code

Paste JavaScript, drop one or more .js files onto the editor, or upload them. Several files are joined in order. Syntax errors show the exact line and column, with a button that jumps to the error.

Pick a preset

Start with Balanced. Open Minifier settings to change compression passes, name mangling, top-level scope, console removal, comments or source maps.

Copy or download

Check the size and gzip numbers, then copy the output or download the .min.js file and its .map. Your last 20 runs are kept in local history.

What minification does to your code

A minifier removes whitespace and comments, shortens local names, and rewrites expressions into equivalent shorter forms. The code still does exactly the same thing.

Before · 298 bytes

// Sum the price of every item in the cart
function calculateTotal(items, taxRate) {
  let subtotal = 0;
  for (const item of items) {
    subtotal += item.price * item.quantity;
  }
  const tax = subtotal * taxRate;
  if (tax > 0) {
    return subtotal + tax;
  } else {
    return subtotal;
  }
}

After (Balanced) · 105 bytes

function calculateTotal(t,c){let n=0;for(const c of t)n+=c.price*c.quantity;const o=n*c;return o>0?n+o:n}

Comments and whitespace are gone, the parameters became t and c, and the if/else became a ternary. calculateTotal keeps its name because it's a global that other scripts may call. The Top-level scope option renames globals too.

Safe vs Balanced vs Aggressive

Each preset is a set of Terser options. Choose based on how self-contained your script is.

What each preset turns on.
Setting Safe Balanced Aggressive
Compression passes123
Output ECMAScriptES5ES2020ES2020
Mangle local namesYesYesYes
Top-level manglingNoNoYes
Keep class & function namesYesNoNo
Drop debuggerNoYesYes
Drop console.*NoNoYes
CommentsLicense onlyLicense onlyNone
Best forLegacy code, code reading fn.nameMost websites and librariesSelf-contained bundles and widgets

Rule of thumb: use Balanced. Use Safe if something breaks after minifying. Only use Aggressive when no other script on the page reads your global variables.

Tips for smaller, safer JavaScript

Minification is one step. These habits get the rest of the savings without surprises.

Serve gzip or Brotli

Minify and compress together. The gzip figure above is roughly what visitors download. Brotli on the server is usually another 10–20% smaller.

Ship a source map

Keep the .map next to the .min.js file so production errors point to real lines. If you don't want the original source to be public, upload the map to your error tracker instead.

Test after dropping console

Drop console removes the whole call, including its arguments. Code like console.log(counter++) changes behaviour, so run your tests on the minified build.

Frequently asked questions

Common questions about minifying JavaScript.

Is my JavaScript uploaded to a server?

No. Minification runs in your browser using the Terser library, which is loaded from the jsDelivr CDN. Your code never leaves your device, so private source and API keys stay local.

Does this minifier support ES6 and newer JavaScript?

Yes. It uses Terser 5, which parses modern JavaScript, including arrow functions, classes, class fields, private #members, async/await, async generators, optional chaining (?.), nullish coalescing and assignment (??, ??=), BigInt, import and export. The old UglifyJS engine can't parse most of these.

What is the difference between Safe, Balanced and Aggressive?

Safe runs one compression pass and keeps class and function names, for code that relies on Function.name. Balanced runs two passes, removes debugger statements and targets ES2020 output. Aggressive runs three passes, mangles top-level names, removes console calls and strips every comment. Only use it for self-contained bundles, because top-level mangling renames globals that other scripts may use.

Will minifying break my code?

With the Safe and Balanced presets, correct code keeps behaving the same. Problems usually come from three things: top-level mangling of globals that other scripts reference, dropping console calls whose arguments have side effects, and code that depends on function or class names. Test the minified file before deploying.

What is a source map and do I need one?

A source map is a .map file that links minified code back to the original lines, so browser dev tools and error trackers show readable stack traces. Turn on Source map in the settings, download both files, and serve the .map next to the .min.js file. The minified output already ends with the matching //# sourceMappingURL comment.

How much smaller will my JavaScript get?

Hand-written JavaScript with comments usually shrinks by 40–70% before compression. Code that is already bundled or minified shrinks much less. The tool shows the gzip size for both input and output, which is closer to what is actually sent over the network.

Can I un-minify or beautify JavaScript?

Yes. Switch to Beautify mode to reformat minified code with 2 or 4 space indentation. The structure becomes readable again, but mangled names such as t and e can't be turned back into the original names.

Are license comments kept?

By default, comments starting with /*! or containing @license, @preserve or @cc_on are kept, since many open-source licenses require attribution to be preserved. In the settings you can also remove all comments or keep all of them.

Can I minify several files into one?

Yes. Select or drop several .js files at once. They're joined in the order you picked them, each separated by a comment with its file name, and then minified as one script.

Is the JavaScript Minifier free?

Yes. It's free, needs no sign-up, and has no limit on how many files you minify.

Other browser-based utilities from SeeB4Coding.