About JavaScript minification
A JavaScript minifier shrinks JS files by removing whitespace and comments and shortening local variable names, without changing what the code does. Smaller scripts download and parse faster. Paste your JavaScript, minify it, and copy the compact output. It runs entirely in your browser using the Terser engine.
How JS Minify works
How to minify JavaScript
- Paste your JavaScript in the box above.
- Click minify — the code is compressed and variable names are shortened.
- Copy the smaller script for production.
What minification does
It removes comments and whitespace, shortens local variable names and applies safe optimisations, while keeping the program behaviour identical. The result is smaller and faster to load.
Tips
Minify a copy and keep your readable source for development. If minification reports an error, fix the syntax in your original code first.
Minification vs compression
Minification and server compression work together for the smallest, fastest scripts. Minifying shrinks the code itself — removing whitespace and comments and shortening local variable names — while gzip or Brotli compresses the bytes as they are sent to the browser. Using both gives a much smaller download than either alone. Keep your readable source under version control and minify only for production builds.
Common uses
- Shrink JS for faster page loads
- Improve PageSpeed and Core Web Vitals
- Reduce script bandwidth
- Minify before deploying
- Compress a small library or widget
- Compare original vs minified size
- Bundle-free quick minification
- Optimise inline scripts