What is JS Minifier?
The JS Minifier is an online tool that compresses JavaScript code to its smallest possible size while preserving identical functionality. JavaScript is typically the largest render-blocking resource on modern web pages, and reducing its size directly improves load times, Time to Interactive, and overall Core Web Vitals scores. This minifier performs multiple levels of compression: removing whitespace and comments (basic), shortening local variable and function names (mangling), and applying dead-code elimination and constant folding (advanced). It uses a production-grade parsing engine that understands ES2024+ syntax including optional chaining, nullish coalescing, top-level await, and class fields, ensuring your modern JavaScript is compressed safely.
Why Use JS Minifier?
While bundlers like Webpack, Rollup, and esbuild include built-in minification, developers frequently need a standalone minifier. Common scenarios include compressing third-party scripts that ship unminified, preparing inline <script> blocks for emails or embeds, reducing the size of serverless function code to meet deployment size limits, and quickly checking how much compression a script can achieve before integrating it into a build pipeline. This tool provides instant results with detailed statistics — original size, minified size, gzip estimate, and compression ratio — so you can make informed decisions about code optimization.
How to Use
Paste your JavaScript code into the input editor or upload a .js file. Select the compression level: 'Whitespace Only' removes formatting without renaming anything, 'Standard' also mangles local variable names, and 'Aggressive' adds dead-code elimination and constant folding. Click 'Minify' to compress. The output panel shows the minified code and a size summary. You can toggle source map generation if you need to debug the minified code later. Copy the result or download it as a .min.js file. Optionally download the accompanying .map file for source mapping.
Example Usage
You have a utility library of 200 lines with descriptive variable names and extensive JSDoc comments. Pasting it into the minifier with 'Standard' compression produces output that is 65% smaller: descriptive names like 'calculateTotalPrice' become short identifiers like 'a', and all comments are stripped. The statistics show: Original: 8,200 bytes → Minified: 2,870 bytes → Gzip estimate: 1,100 bytes. This tells you the script will transfer as roughly 1.1 KB over the network, which is well within performance budgets.
Benefits
Significant file size reduction speeds up page loads and reduces bandwidth costs. Multiple compression levels let you choose the right trade-off between readability and size. Source map support maintains debuggability in production. Gzip size estimation gives a realistic picture of transfer size. Support for modern ES2024+ syntax means you do not need to transpile before minifying. No installation or build configuration required.