JavaScript Minifier

Compress JavaScript by removing comments, whitespace, and debug statements - reduce bundle size for faster page loads. Everything runs in your browser, nothing is uploaded.

FREE
Minification Options
Input JavaScript
Note

How it works

This minifier safely processes JavaScript using a tokenizer-aware approach to avoid corrupting strings and regex literals.

→ String literals ("…", '…', `…`) are preserved intact
→ Regex literals are detected and left untouched
→ Comments inside strings are not accidentally removed

Before vs After

Before (127 bytes)
// Calculate total price
function getTotal(items) {
  console.log('items:', items);
  return items.reduce(
    (sum, item) => sum + item.price, 0
  );
}
↓ minified
After (57 bytes)
function getTotal(items){return items.reduce((sum,item)=>sum+item.price,0);}
55% smaller
Keep your source files
Minified JS is not human-editable. Always maintain the original source in version control, and only serve minified files in production.

Production tips

Combine minification with gzip/Brotli compression on the server for best results - typically another 60-80% reduction.
Add source maps (.map files) in production to allow debugging of minified code.
For complex projects use Terser or esbuild - they additionally tree-shake, mangle variable names, and handle module bundling.