How javascript minifier works
JavaScript minification shrinks a script by removing comments, redundant whitespace, and the spaces around operators and punctuation that the parser does not need. The minified code is functionally identical but smaller, so it downloads and parses faster.
This minifier removes single-line (//) and multi-line (/* */) comments, collapses whitespace, and strips spaces around operators and punctuation. It carefully preserves a space after keywords like return, typeof, and new where removing it would change the meaning (return x must stay "return x", not "returnx"). It reports the size saving in bytes and as a percentage.
Paste your JavaScript and click Minify. The tool is a fast transform suitable for small to medium scripts. It does not rename variables or apply advanced optimisations โ for large production bundles use a full bundler like esbuild, terser, or Rollup, which can also handle modules and tree-shaking.