Free JavaScript Minifier Online
Paste your JavaScript below to remove all unnecessary whitespace and comments. See the exact before/after file size and the percentage reduction achieved.
About the JavaScript Minifier
JavaScript minification reduces file size by removing all characters not required for execution — whitespace, newlines, single-line comments (//), block comments (/* */), and redundant whitespace around operators. The resulting code is functionally identical but faster to download and parse.
This tool performs whitespace and comment stripping without variable renaming or dead code elimination, making the output safe and predictable. For advanced minification with variable mangling, use a build tool like Terser or esbuild in your pipeline.
How to Minify JavaScript
Paste Your JS
Copy your formatted JavaScript and paste it into the input area.
Minify
Click "Minify JS". The right pane shows the compressed single-line output.
Check Reduction
The stats bar shows original size, minified size, and percentage saved.
Copy & Deploy
Copy the minified JS and use it in your production script tag or bundle.
Frequently Asked Questions
Yes. This minifier only removes whitespace and comments. It does not rename variables, reorder statements, or modify any logic. The output is semantically equivalent to the input.
Yes. The minifier tokenizes strings (single, double, template literals) and regex literals to avoid incorrectly stripping whitespace or comment-like sequences inside them.
Well-commented, formatted JavaScript typically sees 25–45% size reduction from whitespace and comment stripping. Combined with gzip compression on the server, total transfer size savings exceed 80%.
You can beautify minified code using the JS Formatter, but original variable names and comments removed during minification cannot be recovered.