JavaScript Minifier

Minify JavaScript locally in your browser and see the exact byte savings.

How to use

  1. Paste your JavaScript into the input field.
  2. Select Minify to remove comments and whitespace and apply safe optimizations.
  3. Review the size statistics, then copy the result or download script.min.js.

About this tool

JavaScript Minifier uses Terser to parse your code, which is never executed. It removes comments and whitespace, applies Terser's default safe optimizations and shortens local variable names. Top-level names, property names, function and class names and debugger statements are kept, and the syntax is not transpiled or polyfilled. This is a minifier, not an obfuscator. Sizes are measured in UTF-8 bytes; the output can be larger than the input in some cases. Code with syntax errors is reported and left untouched. Scripts are parsed as classic scripts, so import/export and top-level await are not accepted. Everything runs in your browser and your code is never uploaded.

Related tools