JS Minifier
Compress JavaScript by removing comments, whitespace, and unnecessary characters to reduce file size and improve load performance.
About JS Minifier
JavaScript minification reduces file size by stripping developer-facing content that the browser doesn't need — comments and indentation whitespace. This tool performs safe, comment-aware minification that respects string literals and regex patterns so the output code is functionally equivalent to the input.
What this tool does
- Removes single-line comments — Strips
// ...comments (safe, aware of strings). - Removes block comments — Strips
/* ... */blocks. - Collapses whitespace — Replaces multiple spaces and newlines with a single space where safe.
How to Use
- Paste your JavaScript into the input area.
- Click Minify — the compressed JavaScript appears in the output.
- The tool shows the original vs. minified size and compression ratio.
- Click Copy to copy the minified code for your project.
How It Works
The minifier removes comments, strips unnecessary whitespace and newlines, shortens variable names where safe, and removes optional semicolons. The resulting code is functionally identical but significantly smaller.
Example
A 50KB script typically minifies to 20–30KB — a 40–60% reduction. Combined with gzip compression on your server, the delivered payload can be as little as 10–15KB.