JavaScript Minifier
Compress and minify your JavaScript code to reduce bundle size and optimize performance.
Why Minify JavaScript?
Source files carry comments, indentation, and descriptive names that help developers but add bytes to what visitors download. Minification strips those extras without changing what the code does.
Smaller files download faster and use less bandwidth, which helps page experience on slow or metered connections. Use minification alongside other optimizations such as compression and caching rather than as a substitute for them.
How JavaScript Minification Works
The minifier runs Terser with compress and mangle enabled. Terser removes comments and whitespace, shortens local names, and applies optimizations such as dead-code elimination and constant folding. The result is shown next to the original byte counts so you can see the actual reduction for your file.
Because parsing happens in the browser, syntax errors are reported back with Terser's error message and no code is sent to a server.
Frequently Asked Questions
What is JavaScript minification?
Minification removes characters that people need but browsers do not: whitespace, comments, and line breaks. Terser also mangles local variable and function names and applies compress optimizations while keeping the code's behavior.
Does minification affect code quality?
No. The minified code runs the same as the original; only the human readability changes. Keep your original source for development, and read the minified output carefully if you edit it directly.
How much size reduction can I expect?
Savings depend on how much whitespace and how many comments the original contains and on how long its identifiers are, so there is no fixed percentage. The tool reports the exact original size, minified size, and percentage reduction after each run.
Which tool does the minifier use?
It uses Terser with compress and mangle enabled, loaded in your browser only when you click Minify JavaScript. Your code is not uploaded.