Getting your file…

Free · runs in your browser · no upload · no quota

JavaScript Minifier & Beautifier

Paste JavaScript to minify it for production — shorter names, no whitespace, dead code removed — or beautify minified code back into readable, indented JavaScript. It runs terser, the minifier behind most build tools, right in your browser.

Good to know

License comments are kept.

Comments that start with /*! or contain @license or @preserve are kept by default, as most licenses ask. Untick the option to remove them too.

console.log only when you ask.

Remove console.log drops console calls entirely, which is handy for production builds but hides logging you may rely on. It is off by default.

Minify once, from the source.

Keep your original file. Minifying beautified code again works, but you lose the original names and comments for good once you overwrite the source.

How to Minify or Beautify JavaScript

  1. Add your code
    Paste JavaScript into the left box, drop a .js file onto it or click Open file.
  2. Choose Minify or Beautify
    Minify makes the smallest code that still runs the same; untick Shorten names to keep them readable, tick Remove console.log for production. Beautify lays minified code out with indentation.
  3. Copy or download
    The result appears on the right with the size before and after. Copy it, or download it as a .js file.

Example

JavaScript
function greet(name) {
  // say hello
  var message = 'Hello, ' + name;
  return message;
}
Result
function greet(e){return"Hello, "+e}

Frequently Asked Questions

More browser tools