JavaScript Minifier

Fast structural JavaScript minify — strip comments, collapse whitespace, drop blank lines. See size before/after and the saving percentage.

Enter input above to see the result.

What is this for?

A structural JavaScript minifier strips comments and unnecessary whitespace without changing what the code does. The output is functionally identical to the input — same identifiers, same logic — just shorter. This tool runs that pass in your browser, including the tricky bits: it preserves string contents and regex literals untouched, and keeps newlines where ASI (Automatic Semicolon Insertion) would otherwise change behaviour.

When to use it

How it works

Common gotchas

Limits and reality check

This tool is honest about what it can do. It's good for quick, ad-hoc shrinking and for understanding how much whitespace and comments weigh in your codebase. For anything shipping to users, a proper build tool with dead-code elimination and variable mangling will always win. Use this to get a baseline; use terser or similar to ship production code.