Skip to content

Developer tools

JavaScript Minifier

Minify JavaScript with terser, entirely in your browser. Renames variables, drops comments and dead code, and shows exactly how many bytes it saved.

empty

About the javascript minifier

Minifying strips everything a machine does not need from JavaScript: whitespace, comments, long variable names, unreachable branches. The code does the same thing and arrives faster, which on a slow connection is the difference between a page that feels instant and one that does not.

This runs terser — the same minifier that sits inside most build tools — compiled to run in your browser. It is around a megabyte, so it is loaded only when you press Minify rather than on page load. That keeps the editor usable immediately and costs nothing to anyone who came here to read rather than to minify.

Renaming variables is where most of the saving comes from, and it is safe for local names because nothing outside the function can refer to them. It is left switchable because there are cases where it is not what you want — debugging a specific build, or code that reflects over its own parameter names, which some older dependency-injection frameworks do.

Nothing is uploaded. That is a real consideration for source code rather than a slogan: proprietary logic, embedded configuration and the occasional key that should not have been in the file all get pasted into online minifiers every day, and those uploads leave your control the moment you press the button.

One thing worth setting expectations on. Minifying is not the same as compressing, and the two stack. Gzip or Brotli on your server removes repetition, which minifying leaves behind; minifying removes structure, which compression cannot. Doing both is normal, and the byte count here reflects only the first.

Frequently asked questions

Was this tool helpful?