It does more than delete whitespace
This tool runs Terser inside your browser — the very minifier your bundler (webpack, Vite, Rollup) uses for a production build. It parses the code into a syntax tree and writes it back out.
| Stage | What it does |
|---|---|
| Strip whitespace and comments | The basics. Usually 20–30% off |
| Shorten variable names | Local userName becomes a. This is where the big win is |
| Drop dead code | Unused variables, if (false) blocks and unreachable code go away |
Watch out: shortening names
Only local variables change. Globals and object properties are left alone, because something outside can reach them by name. Even so, these will break:
- Code that refers to a function's name as a string (comparing
fn.name, say) - Frameworks that resolve dependencies from parameter names, like old Angular DI
- Anything containing
eval()orwith
Always test the minified output before you ship it.
Stripping console
Use it to clear debug logging out of a production build. It removes console.error
as well as console.log, so leave it off if you rely on the console for error
tracking.
Syntax level
This is a minifier, not a transpiler. Choosing ES5 does not turn arrow
functions into function. It only promises that minification will not itself produce
code above that syntax level. If you need to support old browsers, run something like Babel
separately.
Is my code sent to a server?
No. Terser itself (about 1 MB) is downloaded to your browser and executed here. After the page loads, no network is used, so pasting code from work does not put it anywhere. The trade-off is that this page is a little heavier to open than the others.
Can minification be undone?
JavaScript Formatter restores the indentation. The shortened variable names and deleted comments do not come back.
Is this an obfuscator?
No. The output being hard to read is a side effect; the goal is size. If hiding the code is the point, dedicated obfuscators exist — though nothing fully hides code that has been shipped to a client.