Make your JavaScript smaller
JavaScript is often the heaviest part of a web page, and every kilobyte has to be downloaded, parsed and executed before the page becomes interactive. Minifying it can cut its size by half or more. This tool uses Terser, the minifier behind most modern build tools, to remove whitespace and comments, shorten names and apply safe code compressions — right in your browser.
Features
- Terser engine with modern ES2015+ support.
- Compression: dead-code removal, constant folding and shorter syntax.
- Name mangling for local variables (optional).
- License comments kept on request.
- Size comparison in bytes and percent.
- Private: code is processed locally.
Typical savings
| Code | Typical reduction |
|---|---|
| Well-commented application code | 50–70% |
| Library source | 40–60% |
| Already-compact code | 15–30% |
| Already minified code | 0–5% |
Serving minified files with gzip or Brotli compression typically reduces the transfer size by another 60–75%.
Tips
- Keep the original source — minified code is hard to read and debug. Use source maps in your build for debugging production code.
- Minify as a build step for production; this tool is ideal for one-off scripts, snippets, bookmarklets and projects without a bundler.
- Test after minifying, especially code that relies on function names or
eval.
Related tools
Minify stylesheets with the CSS Minifier, pretty-print data with the JSON Formatter, or encode scripts for embedding with Base64.