Developer Tools

Free JavaScript Minifier Online — Compress & Beautify JS Instantly

Minify JavaScript to reduce file size and speed up page loads. Multi-pass compression, beautifier, gzip size estimate and a pass-by-pass analysis. All processing happens in your browser.

586 B
586 chars
Original
391 B
391 chars
Output
33.3%
78.7% with gzip
Saved
125 B
server delivery
~Gzip Size

How to Minify JavaScript Online

1
Paste your JavaScript
Paste your JS code into the input area on the left. The output and statistics update automatically as you type.
2
Choose level
Basic removes only comments and excess whitespace. Standard collapses all whitespace. Aggressive also removes redundant semicolons and optimises keyword spacing.
3
Review the statistics
See original size vs output size, the percentage saved, and the estimated Gzip size. Open Pass Analysis to see exactly what was removed in each step.
4
Copy or download
Click Copy for the minified output, or Download to save as .min.js. Switch to Beautify to format any minified code for readability.

❓ Frequently Asked Questions

What does minifying JavaScript actually do?+
JavaScript minification removes everything that isn't needed for the code to execute: single-line comments (//), multi-line comments (/* */), unnecessary whitespace, indentation, newlines, and redundant semicolons. Advanced minifiers also shorten variable names and optimise certain code patterns. The result is functionally identical code that is smaller in file size, downloads faster and parses faster in the browser.
How much file size can I save by minifying JavaScript?+
Typical minification reduces file size by 30–60% for most JavaScript files. Combined with Gzip compression (applied by web servers automatically), you can achieve 70–85% size reduction. For example, jQuery uncompressed is ~290KB, minified is ~90KB, and with Gzip is ~30KB. The bigger the file and the more comments and whitespace it contains, the larger the percentage savings.
What is the difference between minification and obfuscation?+
Minification removes whitespace and comments to reduce file size while keeping variable names readable. Obfuscation additionally scrambles variable names (making them single letters or random strings), reorganises code flow, and adds anti-analysis techniques — primarily to protect intellectual property. Minification is done purely for performance; obfuscation is done for code protection. Our minifier performs minification — not obfuscation.
Can I reverse minification (unminify/beautify JavaScript)?+
You can beautify/format minified JavaScript to make it readable again — our beautifier mode does exactly that. However, you cannot fully reverse minification if variable names were shortened, because the original names are lost. Comments are also permanently removed. Beautifying just adds back whitespace and indentation so the code structure becomes readable, but minified variable names like 'a' or 'b' remain.
Does minifying JavaScript change how the code works?+
No — minification is designed to produce code that is functionally identical to the original. It only removes non-functional characters (whitespace, comments) and optionally renames identifiers. However, poorly written code can occasionally break — for example, code that relies on function.name, or code with automatic semicolon insertion issues. Always test your minified code in the same environment as the original.