Strip JS comments and collapse whitespace to reduce file size — strings with URLs are safely preserved
Developer Tools
JavaScript Minifier - Minify & Compress JS Online
How to Use
1Paste your JavaScript into the input area
2The minified JavaScript appears instantly
3Review the size savings stats
4Copy the result with one click
Frequently Asked Questions
It removes single-line (//) and block (/* */) comments, then collapses consecutive whitespace and newlines into a single space. String literals (including those containing URLs like "http://example.com") are protected from modification.
No. The minifier protects all string literals before stripping comments. A line like var url = "http://example.com"; is kept intact — only a true // comment outside a string is removed.
No. This is a basic regex-based minifier that handles comments and whitespace. It does not perform variable renaming, dead-code elimination, or other AST-level optimizations. For production use, a tool like Terser is recommended.
Yes. All processing happens entirely in your browser. Your code is never sent to any server.