JavaScript Minifier
Basic JavaScript minification: strip comments and collapse whitespace to reduce file size.
How to Minify JavaScript
Paste your JavaScript source code into the editor, click Minify JavaScript, and the tool removes single-line comments, multi-line comments, and collapses unnecessary whitespace. The output panel shows original and minified sizes along with the percentage reduction. This is a lightweight, browser-based minifier intended for quick size checks and simple scripts. For production builds with advanced optimizations like dead-code elimination and variable mangling, use a dedicated build tool such as Terser or esbuild.
When to Use This Tool
This minifier is perfect for quick tasks: shrinking a snippet before embedding it in an HTML page, removing debug comments before sharing code, or estimating potential size savings. It handles the most impactful optimizations — comment removal and whitespace collapse — which typically account for 30 to 50 percent of the size reduction in well-commented code. The entire process runs in your browser with no server involvement, so your code stays private. For full production optimization, pair this with tree-shaking and module bundling in your build pipeline.