JavaScript Minifier
Shrink JavaScript by stripping comments and extra whitespace — and see how many bytes you save.
How to Use This Tool
Paste your JavaScript, then minify. Copy the compact version into a production bundle or a <script> tag.
- This is a simple comment and whitespace minifier — it does not rename variables or tree-shake modules.
- Always test code that relies on automatic semicolon insertion after minifying.
Practical Example
Minify this snippet:
/* note */
function add(a, b) {
return a + b;
}
The output drops the comment and the extra spaces:
function add(a,b){return a+b;}
What Your Results Mean
- Minified JS — the same code with comments and extra spaces removed.
- Saved bytes — the difference between the original and minified sizes.
- Savings percent — the share of the file that was comments or whitespace.
Frequently Asked Questions
Does this rename variables?
No. Names stay as written. For mangling and dead-code removal, use a bundler such as Terser in your build.
Are comments removed?
Yes. Block comments /* ... */ and line comments // ... are stripped. Text inside strings is kept.
Is ASI-sensitive code safe?
Whitespace that JavaScript needs for automatic semicolon insertion is kept around return/throw/yield when possible, but you should still test.
Is my code uploaded?
No — minification runs entirely in your browser.
How does this help performance?
Smaller files download and parse faster. Combined with gzip, savings are often 20-40% on hand-formatted scripts.