A JS minifier makes JavaScript files smaller by removing comments, spaces and line breaks, and by giving local variables short names. The code still does the same thing, but the browser downloads fewer bytes. This tool does it in your browser. Enter a page URL to minify every script on it, or paste your code and download a ready .min.js file.
What minifying JavaScript changes
People write code for people. They use clear names like totalQuantity, add comments, and indent every block. A browser needs none of that. Minifying keeps the logic and drops what only helps a human reader.
Here is a short example. The first line is the original, and the second is what you get with all options on:
function addToCart(productId, quantity) { const items = readCart(); items.push(productId); }function addToCart(t,n){const r=readCart();r.push(t)}
The function name stays the same, because other code may call it. The names inside the function get shorter, because nothing outside can see them. That is the main idea behind "mangling".
Google's Lighthouse report lists unminified JavaScript as an opportunity and shows how many KiB each file could save. Smaller scripts download faster, and on a slow phone connection every saved kilobyte counts. I used to chase speed in the wrong places. For years I paid for hosting plans that promised to be many times faster, and I felt no difference on my sites. Trimming the files every visitor downloads is cheaper and easier to check.
How this tool works
The tool runs Terser, a widely used open-source JavaScript minifier. It loads once from a public code server (cdn.jsdelivr.net) the first time you press a minify button. After that, everything happens on your device.
Tab 1: minify every script on a page
- Enter the address of a page, such as your home page.
- The tool downloads the page and finds every
<script src>file and every inline script. - It fetches each file and minifies it on its own.
- Each file gets a card with the original size, the minified size and the percent saved. Use Preview to compare the code, Copy to copy it, or Download .min.js to save it.
- Download all .min.js (.zip) saves every file in one archive.
Blocks like JSON-LD schema and HTML templates are data, not code, so the tool skips them and tells you how many it skipped. If a file has a syntax error, its card shows the line and column, and the tool does not touch that file.
Tab 2: paste your own code
Paste JavaScript in the editor and press Minify JS (or Ctrl+Enter). You get three numbers: the original size, the minified size and the percent saved. You also see the gzip size, which is close to what visitors really download when your server compresses files. Then use Copy Minified JS or Download .min.js File. If your code uses import or export, tick "ES module", or the tool switches to module mode by itself when it sees them.
The four cleaning options
Each option has its own checkbox. When you change one, the tool runs again on the code you already loaded.
| Option | What it does | When to turn it off |
|---|---|---|
| Remove comments | Deletes comments but keeps license notes that start with /*! or hold @license | When you need every note for review |
| Remove console logs and debugger | Drops console.log, console.warn and similar calls, plus debugger lines | When you debug a live site on purpose |
| Mangle variable names | Gives local variables one- or two-letter names | When an old script reads its own variable names |
| Compress sequences | Joins statements with commas, so a(); b(); becomes a(),b(); | Rarely; it is safe on normal code |
"Remove console logs" is off by default. Many sites log errors to the console on purpose, and removing those calls can hide problems from you later. Turn it on for code you have finished testing.
Keep license comments in place. Most open-source licenses ask you to keep the notice in every copy, and those notes are only a few bytes.
How much will a JS minifier save?
It depends on how the code was written. Hand-written scripts with comments and long names often shrink by 30 to 60 percent. Files that end in .min.js are already minified, so they save almost nothing, and the tool marks them "Already minified". Libraries from a CDN usually come minified too.
Gzip and Brotli compression on your server shrink files again on the way to the visitor. Minified files still compress better than the original, so the two work together. Check the gzip number in the stats to see the real gain.
How to put the minified files on your site
- Back up the original files. Keep the readable versions. You will need them for every future edit.
- Upload the .min.js file next to the original, through your hosting file manager or FTP.
- Change the script tag in your template to load the new file name, for example
app.min.js. - Test the site. Open menus, submit a form, add something to a cart and check the browser console (F12) for red errors.
- Clear your cache and any CDN cache so visitors get the new file.
On WordPress, a caching or optimization plugin may already minify scripts. Do not minify the same file twice, and never edit theme or plugin files directly, because the next update overwrites them. Use this tool for your own scripts and for small sites built with plain HTML, like the templates I wrote for Bloghints before it moved to a CMS.
Things a minifier cannot fix
A minifier removes characters, not features. A slider library you load on every page stays the same library after minifying. If you want to know how much of a script a page really runs, record the page in the Coverage tab of Chrome DevTools. It shows used and unused bytes for each JavaScript and CSS file. For styles, our CSS minifier and unused CSS checker finds rules a page never uses.
Privacy and the proxy
Minifying runs in your browser. Bloghints does not store your code and has no database for this tool. Browsers do not let one site read files from another site, so URL mode first asks the Bloghints server to fetch the page and its scripts. It passes each file straight back to your browser and stores nothing. If that fails, the tool tries free public proxies (allorigins.win, codetabs.com, corsproxy.io), which can see the addresses you enter. Some sites block proxies. If a file fails to load, open it in your browser, copy it, and use the Direct Paste Code tab.
Use the JS minifier on your own scripts first, test your pages, then upload the smaller files. Keep the originals for editing and the minified copies for visitors. For heavy images, which are often bigger than all your scripts together, try our image to WebP converter.
Frequently asked questions
Is minified JavaScript safe to use?
Yes, when the minifier understands the code. Terser parses the whole file first and stops with an error if the code is broken, so it does not produce half-working output. Still, test your site after you upload the new files, and keep the original files as a backup.
Can I turn minified code back into the original?
Not fully. A code formatter can add spaces and line breaks again, but comments and the original variable names are gone. Always keep your readable source files and minify a copy.
Why does a script fail to minify?
Usually the file has a syntax error, or it is not JavaScript at all, such as a 404 page or a login page. The card shows the error with its line and column. Fix that line in your source and run it again, or paste the code in the Direct Paste Code tab to test it.

