Paste JavaScript and get a smaller file back, with the saving shown in bytes.
Original 2.3 KB minified to minified 0 B
100% smaller (2.3 KB saved)
Working out the gzipped size…
How It Works
Paste the script into the left pane, or drop a .js file onto it. Everything runs in your browser, so nothing is uploaded.
Open Options to switch compression, name shortening, keep function names, keep licence comments, safe mode and the output syntax. Small files minify by themselves; large ones wait for the Minify button.
The strip shows the original size, the minified size, the percentage saved and the gzipped size of both. Copy the result, download it as a .min.js file, or publish a share page in one click.
About This Tool
Terser, running entirely in your browser, with the saving shown in plain bytes and in gzipped bytes.
This JavaScript minifier is the terser engine - the compressor behind many JavaScript build tools, and the successor to UglifyJS - running as an ordinary web page. It parses your script properly, so it does three things a search-and-replace never could: it removes comments and whitespace, it compresses the code itself (unused variables, unreachable branches, expressions that can be written shorter), and it renames local variables and function arguments to single letters. What comes back is the same program in fewer bytes, ready to copy, download or publish.
Most people who land here are holding a script somebody or something else wrote: the widget ChatGPT or Claude generated, a snippet from a tutorial, a tracking or cookie-banner script a supplier sent over, the JavaScript at the bottom of a one-page site. You do not need a build step or a terminal to compress JavaScript for a page like that - paste it in, take the smaller version, paste it back into your <script> tag. It is also a quick way to answer "how much of this file is actually comments and indentation?" before deciding whether the minifying is worth it.
The minifier is downloaded to your browser the first time you press Minify and then runs there. Your code is parsed as text and is never executed, evaluated or sent anywhere; the tool has no server side at all until you choose to publish. Two sets of numbers are reported: raw UTF-8 bytes, which is what the 5 MB instant-publish limit counts, and gzipped bytes, which is what a browser really downloads from any host that compresses its responses. On anything but a tiny snippet the gzipped figure is the smaller and more honest one, and it is why a 45% raw saving often turns into a 30% real one.
Terser is a minifier, not a transpiler. The output syntax setting limits which shortcuts it uses when printing; it will not turn modern class or arrow syntax into ES5 for an old browser. It also cannot bundle files, remove code that only your framework knows is unused, or fix a script that was already broken - a syntax error is reported with its line number and the previous output stays on screen. If a library reads function names at runtime, turn on Keep function names; if anything behaves oddly after minifying, turn on Safe mode, which switches off the compressor steps that can change behaviour in edge cases. To go the other way, the JavaScript Formatter turns a minified file back into readable code, and the HTML Minifier does the equivalent job for the page around it.
A script on its own is not a web page, so Publish builds a small page that presents the minified code and the bytes saved - handy for sending to a client or a colleague - and puts it on a live OxyPages link with HTTPS in seconds, with no account. The published page shows the code as text and does not run it. The link lasts 30 minutes unless you claim it, and claiming is free; from there you can pick your own address and, on a paid plan, connect a custom domain. To ship the script for real, paste it into a <script> tag in your page or upload the .min.js file alongside your HTML in a ZIP. See how it works for the full picture.
Questions
More Free Tools
Every tool here runs in your browser and ends the same way: one click and your HTML is on a live link.
Turn minified or messy JavaScript back into readable code with proper indentation and line breaks. Free, instant, and it never leaves your browser.
Minify CSS to cut bytes: strip comments and whitespace, keep every rule intact, see the savings. Runs in your browser. Copy or download the result.
Minify HTML to shrink your page: strip whitespace and comments, collapse attributes, see the bytes saved. Then publish the smaller file for free.
Try It Now
Still Here? Drop It In.
The whole pitch fits in one sentence: your HTML, on a link, in seconds.
Drag and drop your HTML file(s), folders, or ZIP file
or ·
No account needed. Your unclaimed website stays live for 30 minutes on a free subdomain. Claim it to your account to keep it permanently.