Minify JavaScript directly in your browser using Terser. Paste code or upload a .js, .mjs, or .cjs file, choose the optimization options, then copy or download the result. Your source code is not uploaded to Flipper File.

Input JavaScript

Paste code or load a local JavaScript file.

0 lines 0 characters 0 B

Minification Options

These options map to Terser's parser, compressor, mangler, and formatter.

License mode keeps common @license, @preserve, @copyright, and /*! notices when Terser can retain them.

This controls transformations Terser may emit. It is not a transpiler and does not convert unsupported modern syntax into older JavaScript.

Extra passes can sometimes shrink code further but take more processing time.

Production note: This tool deliberately does not enable Terser's unsafe compression options or property-name mangling. Those settings can produce smaller output but require more knowledge of the surrounding application.

Your JavaScript source is minified in this browser. On the first minification, the page downloads the pinned Terser library from a public CDN; your source code itself is not sent with that library request. Self-hosting the Terser bundle removes that third-party asset request entirely.

JavaScript Minifier Online

This JavaScript minifier reduces JavaScript file size in the browser using Terser, an AST-based JavaScript parser, compressor, and mangler. Paste source code or open a local JavaScript file, choose the optimization settings, and download a minified .min.js file.

What JavaScript Minification Does

Minification rewrites JavaScript into a smaller equivalent form. Depending on the selected options, this can remove comments and unnecessary syntax, simplify expressions, eliminate unreachable code, and shorten local identifiers.

For example:

function add(firstNumber, secondNumber) {
  const total = firstNumber + secondNumber;
  return total;
}
console.log(add(10, 20));

can be reduced to a much smaller form while preserving the same intended behavior.

Why This Tool Uses a JavaScript Parser

JavaScript cannot be safely minified by blindly deleting comments, spaces, semicolons, or line breaks. Those characters can be meaningful inside strings, regular expressions, template literals, automatic semicolon insertion boundaries, and modern syntax. This tool uses Terser so the code is parsed as JavaScript before it is rewritten.

How to Minify JavaScript

  1. Paste JavaScript into the editor or upload a .js, .mjs, or .cjs file.
  2. Choose whether to compress code and mangle local names.
  3. Set module mode and compatibility options if your source requires them.
  4. Click Minify JavaScript.
  5. Review the size reduction, then copy or download the result.

Compression vs. Mangling

Compression changes the structure of expressions and statements when an equivalent, shorter representation is available. Mangling shortens eligible identifier names. They are separate operations, so either can be disabled when debugging or when a project depends on runtime-visible function or class names.

JavaScript Modules

Enable module mode for JavaScript that uses import or export. Module code is treated as strict-mode JavaScript and Terser can optimize its top-level scope differently from a traditional browser script.

ECMAScript Level Is Not Transpilation

The ECMAScript optimization setting tells Terser which syntax level it may use while optimizing output. It does not transform modern language features into equivalents for older browsers. A transpiler such as Babel is needed when that kind of compatibility conversion is required.

Does Minification Execute My JavaScript?

No. The source is passed to the minifier as text and parsed into JavaScript syntax; the code is not intentionally executed by this tool. A syntax error is reported instead of producing output.

Private Browser-Side Processing

Minification happens in your browser. Flipper File does not need the source file to perform the conversion on a server. The Terser library is lazy-loaded from a CDN when the tool is first used, so the browser makes a library asset request unless that dependency is self-hosted.

When to Use a Full Build Pipeline

A browser minifier is useful for one-off scripts, debugging, prototypes, snippets, and small deployments. Larger applications normally benefit from a build pipeline that can bundle modules, tree-shake dependencies, generate source maps, transpile syntax, and run repeatable production builds.

Our Full Dev Tool Library

Flipper File