Minify JavaScript Online — Real Terser, In Your Browser
Actual Terser minification — compressed and mangled correctly, not regex-mangled into bugs.
🔒 Runs in your browser — files never uploaded ⚡ No signup 💯 Free
Minify JavaScript with Terser — the same minifier your build tools use — running entirely in your browser. Comments and whitespace go, local names are mangled, expressions are compressed, and the output is correct, because it comes from a real parser rather than the regex tricks that break code through semicolon insertion.
Your source never leaves your machine; the minifier itself is fetched once (about 1 MB) the first time you use this page.
How to use JavaScript Minifier
- Paste your JavaScript.
- Click Minify. The first run fetches Terser; after that it's instant.
- Check the saving — typically 40–70% before gzip.
- Copy or download the result as a .js file.
Why regex minifiers break code — and this doesn't
JavaScript's automatic semicolon insertion means line breaks carry meaning: return\n{a:1} returns undefined, and naively stripping the newline changes behaviour. Only a real parser knows which whitespace is safe to remove — which is why this page ships Terser rather than a hand-rolled "minifier" that would corrupt exactly the code you care about.
What mangling does and doesn't touch
Local variable and function names become single letters — safe, because they're invisible outside their scope. Property names and globals are left alone by default, because renaming those breaks any code that references them across files. If your build pipeline does property mangling, it does so with explicit configuration; a paste-in tool shouldn't guess.
Minified vs gzipped — you want both
Minification and compression stack: minifying removes what gzip can't (dead code, long names), gzip then squeezes the rest on the wire. Typical numbers: 100 KB source → 40 KB minified → 12 KB gzipped. The percent shown here is pre-gzip; your server's compression multiplies it.
Going the other way
To read minified code, the JavaScript beautifier reverses the formatting (though mangled names stay mangled — that information is genuinely gone).
Frequently asked questions
Is this real minification or just whitespace stripping?
Real: it's Terser — the minifier inside most production build pipelines — compiled to run in your browser. It parses the code, compresses expressions, removes dead branches and mangles local names. Whitespace strippers break JavaScript through semicolon insertion; a parser can't.
Will the minified code behave identically?
Yes, for standard JavaScript — that's Terser's contract, exercised by millions of builds daily. The known edge: code that relies on function names at runtime (Function.prototype.name, error-stack parsing) sees mangled names. That's true of every minifier and rarely matters.
Why is the first minify slow?
The minifier itself is about 1 MB and is fetched on first use — deliberately not bundled into the page, so visitors who never minify JS never download it. After that first run it's cached and instant.
Does it handle modern syntax — modules, async, optional chaining?
Yes — Terser 5 speaks current ECMAScript, including modules, async/await, optional chaining and nullish coalescing. It minifies; it does not transpile — the output targets the same JS version as the input.
Is my source code uploaded?
No. The minifier runs in your browser; your code never leaves your machine. Proprietary source is exactly why this tool is client-side.