Minify JavaScript code to reduce file size and improve load times.
Compress JavaScript code
Paste any JavaScript — a utility function, a module, or a full script. Minification works on any valid JS regardless of whether it uses ES5, ES6+, or modern syntax.
Click Minify to remove whitespace, comments, and redundant syntax. The output is functionally equivalent — the same logic with all human-readable formatting stripped away.
Copy the minified output to your production environment. For repeatable workflows, automate minification in a bundler (webpack, Vite, esbuild) rather than doing it manually per release.
| Technique | What it does | Typical size saving | Reversible? |
|---|---|---|---|
| Minification | Remove whitespace & comments | 30–50% | Partially |
| Bundling | Combine multiple files into one | Reduces HTTP requests | No |
| Tree shaking | Remove unused code paths | 10–40% on large codebases | No |
| Obfuscation | Rename vars, scramble logic | Similar to minification | No |
| Compression (gzip) | Server-side encoding on transfer | 60–80% on top of minification | Yes (automatic) |
JavaScript is the single largest contributor to poor Time to Interactive (TTI) and Total Blocking Time (TBT) scores — two metrics Google uses in Lighthouse and Core Web Vitals assessments. Large, unminified JS files take longer to download, parse, and compile. Every 100 KB of JavaScript adds roughly 350–400ms of processing time on a mid-range Android device. Minifying your scripts is the lowest-effort first step in improving these scores. For larger applications, pair minification with code splitting (loading only the JS needed for each page) and lazy loading for non-critical modules.