Free JavaScript Minifier — Compress JS with Terser Online
How it works
Paste your JavaScript and minify it with Terser — the same battle-tested engine used by professional build tools — running entirely in your browser. Compress mode removes dead weight and shortens expressions; mangle mode additionally renames local variables to shrink the output further. You get the minified code plus exact before/after byte sizes, and any syntax error in your code is shown clearly instead of failing silently.
JavaScript Minifier
Real Terser minification in your browser — compress, mangle, and ship smaller scripts.
1 Paste your JavaScript
2 Minification options
3 Minify it
✅ Your minified JavaScript
Everyday uses
- Faster websites: smaller scripts mean quicker downloads and better Core Web Vitals scores.
- Quick deploys without a build pipeline: paste, minify, upload — no Node.js setup required.
- Shrinking embeds and snippets: compress analytics helpers, chat widgets, and one-off scripts before pasting them into a page.
- Learning tool: compare your code before and after mangling to see what a real minifier actually does.
Frequently asked questions
What is the difference between compress and mangle?
Compress rewrites your code into shorter equivalent forms — folding constants, dropping unreachable code, and simplifying conditions — without changing any names. Mangle goes further and renames local variables and functions to one-letter names, which saves the most bytes but can break code that depends on names (for example eval, string-based lookups, or Angular-style dependency injection).
Is this the real Terser, or a simple whitespace remover?
The real thing. This tool loads the official Terser 5 library — the same engine behind most production build pipelines — and runs it locally in your browser. The only thing that travels over the network is the one-time library download; your code itself is never uploaded anywhere.
What happens if my code has a syntax error?
Terser stops and this tool shows the error message, including the line and column when available, in the results area. Nothing is minified and nothing fails silently — fix the error in your editor and paste again.