Handitab

JavaScript Minifier

Minify JavaScript by removing whitespace and comments and optionally shortening local variable names, then compare the size before and after.

About JavaScript Minifier

JavaScript minification rewrites source code into the smallest equivalent form so it downloads faster. This tool runs Terser, an open-source minifier, in your browser. It parses the code into a syntax tree, removes comments and whitespace, can simplify expressions and drop unreachable code, and can rename local variables to short names. Top-level names are kept so other scripts can still call them. Terser is loaded from a CDN on first use.

How to use JavaScript Minifier

  1. Type or paste into the "JavaScript" box, or press "Use example" to try it with sample data.
  2. Set "Shorten local variable names" and "Simplify code" if the defaults do not fit.
  3. The result appears below and updates as you type.
  4. Copy the result with the copy button, or download it as a file where that is offered.

Questions about JavaScript Minifier

Does minified JavaScript run faster?

Mostly it loads faster, because fewer bytes are downloaded and parsed. Execution speed is nearly unchanged. Serving the file with gzip or Brotli compression on top of minification reduces transfer size further.

Runs in your browser. Page last updated .

More developer tools

All 41 developer tools