JavaScript Minifier
Real minification via Terser — dead-code elimination and identifier mangling.
About the JavaScript Minifier
Minification uses Terser, which does considerably more than strip whitespace. It renames local variables to single letters, removes unreachable code, collapses expressions that can be evaluated at build time, and drops comments — typically 40 to 60 percent smaller before compression.
Only local names are renamed. Anything reachable from outside the scope — exported functions, object properties, global names — has to keep its identifier, because renaming it would break every caller. This is why heavily object-oriented code minifies less than code full of local helpers.
Minified JavaScript is undebuggable without a source map. Generate one in your build, keep it out of production or serve it only to authenticated users, and never rely on minification as a way of hiding logic — anything shipped to a browser can be read.
How it works
Paste your JavaScript, as a module or a plain script.
Terser parses it to an AST, removes unreachable code and renames local variables.
Compare the byte saving, then copy or download the result.
Frequently asked questions
- How much smaller does minifying JavaScript make a file?
- Typically 40 to 60 percent before gzip, because Terser renames local variables to single letters and removes dead code as well as whitespace. Gzip on top of that usually gets the transferred size down by around 70 percent overall.
- Can minification break my code?
- Rarely, but it can if the code relies on function or variable names at runtime — reading Function.prototype.name, or matching on a constructor name. Those names are exactly what minification changes.
- Does minifying protect my source code?
- No. It makes code harder to read, not impossible — anything sent to a browser can be recovered and reformatted. Treat minification as a size optimisation, never as a security measure.
- What is a source map and do I need one?
- A file mapping minified positions back to your original source, so browser dev tools show real names and line numbers. You need one to debug production issues; serve it carefully, since it exposes your original code.
- Is my code uploaded to be minified?
- No. Terser runs in your browser, so proprietary source stays on your machine — which is worth knowing before pasting a bundle into an online tool.
Privacy
Everything happens locally. Your files are read by your own browser, processed on your device, and never uploaded — closing the tab is all it takes to erase them.
Related Developer tools
JSON Formatter
Format, validate and minify JSON with clear error positions.
Base64 Encode / Decode
Convert text and files to Base64 and back, with URL-safe output.
URL Encode / Decode
Percent-encode and decode URLs, query strings and path segments.
HTML Formatter
Beautify or minify HTML with consistent indentation.