Skip to main content

JavaScript Minifier

Minify JavaScript with Terser and see original size, minified size, percent saved and a gzip estimate, with mangling and compression switchable.

For developers checking what a script costs to ship.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

Mangling, compression and what each saves

Whitespace and comment removal is the easy win. Mangling gives the biggest additional drop in code with long local names, since calculateMonthlyPayment inside a function becomes a one- or two-letter name. Compression handles structural shortcuts such as folding constant expressions and dropping unreachable branches.

Switch each option off in turn to see its contribution on your own code. With both off, you still get a smaller file from stripped whitespace and comments. A common workflow: minify with both on, compare the gzip number, and ship the gzip-friendly output with server compression enabled.

  • Mangle names: shortens local identifiers only; top-level names stay.
  • Compress: applies Terser's code-level optimizations.
  • Gzip estimate: compare this, not the raw byte count, against your page-weight budget.

What to watch for

Minified code is hard to debug because names and line structure are gone.

Production builds usually generate source maps for that purpose; this tool does not.

For an application with many files, use your bundler's minifier rather than pasting files one by one, since it can optimize across modules.

Sources

Terser API reference, minify() with compress and mangle options (terser.org/docs/api-reference). The tool bundles Terser 5.51.2. Byte counting follows the WHATWG Encoding Standard (TextEncoder). Gzip compression uses the Compression Streams API as documented on MDN.

To read minified code, use the JavaScript Beautifier. To convert the byte counts to other units, use the Byte Size Converter.

Frequently Asked Questions

Common questions about the JavaScript Minifier

It runs your code through Terser, a JavaScript parser and compressor. Compression rewrites code into shorter equivalents, and mangling renames local variables and parameters to short names. Both are on by default, and each can be switched off. Comments and unneeded whitespace are removed either way. The result updates shortly after you stop typing.

From the same team

Turn your GPU into an OpenAI-compatible API endpoint

Wide Area AI routes your LLM API calls to your own hardware over a Cloudflare Tunnel — free local inference with edge caching and automatic cloud failover. Works with any OpenAI SDK.

Start routing — free

Sources & References

Web platform and protocol references

Authoritative definitions for web technologies, encodings, and data formats used by these developer tools.

Internet standards (RFCs)

Formal specifications for internet formats and protocols.