JS Minifier
Compress JavaScript by removing whitespace and comments, shortening variable names, and applying optimisations to reduce file size.
How JavaScript Minification Works
This minifier uses Terser, a production-grade JavaScript parser and compressor. It removes all whitespace, comments, and unnecessary characters. It also applies optimisations like dead code elimination, constant folding, and variable mangling to produce the smallest possible output.
The output is functionally identical to the input - it will execute with exactly the same behaviour but typically 40-60% smaller in file size.
Minification Techniques
Whitespace Removal
Strips all unnecessary spaces, tabs, newlines, and comments from the code.
Variable Mangling
Shortens local variable and function names to single or two-character identifiers.
Dead Code Elimination
Removes unreachable code, unused variables, and redundant statements.
Why Minify JavaScript
Faster Page Loads
Smaller files download faster and parse quicker, improving Time to Interactive and overall page performance.
Reduced Bandwidth
Minified scripts consume less bandwidth, saving costs for high-traffic websites and mobile users on limited data plans.
Production Deployment
Minification is a standard step in production build pipelines alongside bundling and tree-shaking.
Source Map Compatible
Minified code can be paired with source maps for debugging production issues in developer tools.