JavaScript Minifier
Compress JavaScript by removing comments, excess whitespace, and blank lines.
Compress JavaScript by removing comments, excess whitespace, and blank lines.
Paste your JavaScript code into the input area and click "Minify JS." The tool uses a simple regex-based approach to remove single-line comments, multi-line comments, and excess whitespace. The resulting minified code and size savings are displayed instantly.
JavaScript files are often the largest assets on a web page. Removing comments and unnecessary whitespace reduces file size, leading to faster downloads, quicker parsing, and improved page load times. This is especially important for mobile users on slower connections where every kilobyte matters.
This tool uses a regex-based approach rather than a full AST parser. It handles common cases well but may not catch every edge case, such as comments inside template literals or regex patterns that look like comments. For production builds, consider using dedicated tools like Terser or UglifyJS. This tool is ideal for quick compression, prototyping, and learning.
// ...)/* ... */)All minification happens in your browser. Your code never leaves your device, making it completely safe for proprietary scripts, API keys, or any sensitive logic you need to compress quickly.