Not every project has a bundler, and not every script deserves one. When a site ships a hand-written script tag, this page lets you minify js with the same engine the big build pipelines use: terser runs right in your browser, compressing the code and mangling variable names down to single letters. A 10 KB helper script routinely comes out around half the size before gzip even touches it. Paste your source, press the button, and the badge reports the reduction. It's the javascript minify step for people who'd rather not install Node just to shrink one file.
A single function or a full file both work. Try sample loads a small greeting function so you can watch the transformation happen.
02
Run Minify
Terser compresses expressions and renames local variables. If your code has a syntax error, the exact parser message appears below instead of broken output.
03
Copy into production
Take the single-line result and drop it into your script tag, your CDN upload, or your deployment folder.
Why JS Minifier
Paste your code and minify js in one click. Full terser minification compresses and mangles, so the javascript minify output is as small as it gets.
It reports how many bytes you saved on each run.
Runs in your browser. Your code never leaves your device, so you can minify private scripts safely.
The whole minify step happens locally, with no build tooling to set up.
Free with no limit. Use minify js online as often as you need, with no sign up.
Common questions
What does terser actually do to my code?
Two passes. Compression rewrites expressions, removes dead code, and merges statements; mangling then renames function-local variables to one or two characters. Public API names and anything on the global object keep their names, since terser can't know who else references them.
Why did minifying my JavaScript fail with an error?
Terser parses your code fully before shrinking it, so a stray comma or an unclosed bracket stops the run. The message points at the position of the problem. Fix the syntax and try again; valid input always produces output.
Can the terser output be turned back into readable code?
Formatting can, names can't. The JS Beautifier will re-indent minified output so it's readable, but variables stay as a, b, and c forever. Keep your original source in version control and treat the minified file purely as a build product.
Is minify js online the same as running terser locally?
Same library, same output for the same options. This page runs javascript minify online with compress and mangle enabled, which matches the common default setup. The difference is convenience: nothing to install, and your code never leaves the browser.
How much smaller does minified JavaScript get?
Typically 30 to 60 percent before gzip, depending on how verbose the source is. Long descriptive names, comments, and whitespace all disappear. Combined with server compression, shipping unminified code usually means paying double for no benefit.
Do stylesheets belong in the JS Minifier too?
No, a JavaScript parser will reject CSS outright. Use the CSS Minifier when you want minify css online for stylesheets, and keep each language in its own tool so the output stays valid.
How do I minify js code on this page?
Paste your script and click Minify; terser compresses and mangles it in one pass. To minify js code this way needs no build setup, and as a js minifier online it runs entirely in your browser, so the source never leaves your device. The badge shows the percentage saved.
Can I compress JavaScript for free without a bundler?
Yes. This runs the same terser engine bundlers use, so you can compress javascript free with no Node install and no account. A 10 KB helper often drops to around half its size before gzip even runs. Paste, Minify, copy into production.
Does this do javascript unminify as well as minify?
No, this page only shrinks code. For javascript unminify, meaning expanding minified script back into readable form, use the JS Beautifier, which re-indents it, though the shortened variable names stay shortened. So online javascript unminify is the Beautifier's job, and compression is this one's.