Skip to content

JavaScript Minifier

Minify JavaScript in your browser with terser. The code is parsed, never executed; parse errors report line and column and nothing is run.

Paste JavaScript

Options

Minified JavaScript

Paste JavaScript, choose options, then minify.

The minified JavaScript appears here, with exact byte savings.

Limit for uploaded files: 2 MB. Pasted text is not truncated by the tool — your browser’s memory is the ceiling.

Your file is never sent to a server. It is read and processed by your own browser, and the results are not stored.

How to use it

  1. Paste JavaScript, or choose a .js/.mjs/.cjs file.
  2. Toggle compress and mangle to taste.
  3. Minify, check the byte savings, then copy or download the result.

Limits worth knowing

  • Your code is parsed, never executed.
  • Mangling renames local names only; global properties and exported bindings are untouched unless you compile with them.
  • By default all comments are stripped, including licence comments — keep terser or your build tool for legal-required headers.
  • Files above 2 MB are refused to keep the tab responsive.

Parsed, not executed

A JS minifier is an AST printer, not a runtime. terser reads your source into a tree, applies rewrites, and prints it again. If the input does not parse, the tool reports the parse error and writes nothing — silent corruption is the failure mode that costs you a deploy.

Re-print the output in an editor or a build before shipping it; minified code is not a hand-editing target.

Compress versus mangle

Compress shortens expressions: dead branches disappear and constant expressions fold. Mangle shortens names: `function computeTotal(items)` becomes single letters. Turn mangle off when the output must stay debuggable; turn compress off when you want the output to mirror the source as closely as possible.

Frequently asked questions

Does JavaScript Minifier upload my files to any server?

No. JavaScript Minifier runs in your browser, and the file is read there rather than sent to a server for processing. Our host still sees ordinary page-request metadata, which is described on the privacy page.

Is JavaScript Minifier free to use?

Yes, JavaScript Minifier is free, with no paid tier, no account, and no watermark added to your output. The limits are technical rather than commercial: file size, page count and supported formats are listed on this page.

What file formats and sizes are supported?

JavaScript Minifier supports .js, .mjs, .cjs, .txt files up to 2MB directly in your browser.

Is my code executed by this tool?

Never. The minifier parses the source into an AST and re-prints it. Nothing is evaluated, imported or run — minifying malicious code does not launch it.

What does “compress” and “mangle” mean here?

Compress rewrites expressions to shorter equivalents (dead code elimination, constant folding). Mangle renames local bindings to short names. Both are on by default and independently switchable.

What if my code has a syntax error?

You get terser’s parse error with line and column, and no output at all — this tool will never emit half-minified code that happens to run.

Is my file uploaded?

No. Everything runs in this tab. npm packages terser in the browser bundle; your source is not transmitted.