What JavaScript minification does
Minification makes JavaScript smaller without changing what it does. It removes whitespace and comments, shortens local variable names, and rewrites code into shorter equivalents, such as turning if/else into ternaries.
Smaller scripts download and parse faster, which improves page speed and Core Web Vitals. Combined with gzip or Brotli on your server, a minified file is often a fraction of the original's transfer size.
- Keep source maps for production debugging: minify from your build tool when you can; use this tool for quick one-off files and snippets.
- Need it hard to read too? use the JavaScript Obfuscator.