Free · No sign-up · Runs in your browser

JavaScript Minifier

Compress your JavaScript with Terser, the minifier behind webpack and Vite. Remove dead code, shorten variable names, drop console calls and ship smaller bundles, without your code ever leaving the browser.

More options
Ctrl + Enter
Input Paste, type or drop files
Output Minified code appears here
Original–
Minified–
Saved–
Gzipped–
Time–

Why developers use jsminifier.org

Private by design

Terser runs inside your browser. Your source code is never uploaded, stored or logged.

Industry-grade compression

The same Terser engine used by webpack, Vite and Rollup: dead-code removal, constant folding and name mangling.

Modern JavaScript

Classes, async/await, optional chaining, ES modules and more. Choose the ECMAScript level you ship to.

Clear error messages

Syntax errors show the exact line and column with the offending code, so you can fix them fast.

Combine many files

Drop several scripts at once. They are joined safely in order into a single .min.js file.

Real size stats

Compare original, minified and gzipped sizes, plus a Beautify button to make minified code readable again.

How to minify JavaScript

  1. Add your code. Paste it, type it, or drop one or more .js files onto the input box.
  2. Pick your options. The defaults are safe for production; open the options to fine-tune them.
  3. Minify and ship. Press Minify (or Ctrl + Enter), check how much you saved, then copy or download the .min.js file.

JavaScript Minify API

Automate minification from your build scripts, CI or CMS with a single HTTP request. No key required.

Endpoint
POST https://jsminifier.org/api/
Body
input: your JavaScript (form-urlencoded or multipart)
Optional
format=json for sizes and savings, license=0 to also drop /*! */ comments
Returns
application/javascript with the minified code, or 400 and the error text
Limits
Up to 10 MB per request, 60 requests per minute

The API uses our lightweight server engine (comment and whitespace removal). The browser tool above applies the full Terser optimiser.

curl -X POST https://jsminifier.org/api/ \
  --data-urlencode "[email protected]" \
  -o app.min.js

# sizes and savings as JSON
curl -X POST https://jsminifier.org/api/ \
  --data-urlencode "[email protected]" -d format=json

Frequently asked questions

What does a JavaScript minifier do?

It rewrites your code into the smallest form that behaves exactly the same. Comments and whitespace are removed, local variable names are shortened (mangling), and unreachable or unused code is dropped. Smaller files download and parse faster.

Which engine does jsminifier.org use?

Terser, the most widely used JavaScript minifier, which also powers the production builds of webpack, Vite and Rollup. It fully supports modern JavaScript, including ES modules, classes and async functions.

Is my JavaScript uploaded to your server?

No. With JavaScript enabled, Terser runs entirely in your browser and your code stays on your device. Only if JavaScript is turned off does the form fall back to our server, which minifies the code in memory and does not keep it.

What does Mangle names do?

It renames local variables and function parameters to short names such as a or b. Global names are left alone unless you enable Top-level, so other scripts on your page keep working.

My minified code breaks. What should I check?

Turn on Keep names if your code relies on function.name or class names. Enable Module for files that use import or export. If you target old browsers, set the ECMAScript level to ES5.

Will license comments be kept?

Yes. Comments that start with /*! or contain @license or @preserve are kept by default. Untick Keep /*! comments to remove them too.

Can I beautify minified JavaScript?

Yes. The Beautify button reformats any JavaScript with clean indentation. Mangled variable names cannot be restored, but the structure becomes easy to read.

Minifying stylesheets too? Use our sister tool cssminify.org to merge rules, shorten values and compress CSS, with the same privacy and API.