🗜️ JavaScript Minifier

Minify JavaScript by removing comments, extra whitespace and newlines while preserving strings and syntax. Reduce file size instantly — all in your browser, no upload.

About the JavaScript Minifier

This JavaScript minifier runs entirely in your browser. Paste your code, pick the options, and click Minify to get a smaller version instantly. The minifier tokenizes the source so that string literals, template strings, and regular expressions are preserved — only comments and whitespace are touched. Nothing is uploaded to a server.

Options explained

  • Remove comments — Strips // single-line comments and /* */ block comments. Comments inside strings are preserved.
  • Collapse whitespace — Replaces runs of whitespace with a single space, removes newlines, and trims spaces around operators and punctuation where it is safe.
  • Strip trailing semicolons — Removes semicolons at the end of statements that the ASI (automatic semicolon insertion) rules allow.

How to use the minifier

  1. Paste your JavaScript into the input box.
  2. Tick the options you want to apply.
  3. Click Minify to produce the compressed output.
  4. Check the stats line for original size, minified size, and percentage saved.
  5. Click Copy to copy the minified JS, or Clear to start over.

Frequently asked questions

Will minification break my code? The minifier is conservative: it only removes comments and collapses whitespace. For maximum safety, leave the trailing-semicolon option off, since some code relies on semicolons.

Does it support ES6+ syntax? Yes. The tokenizer handles template literals with ${...}, arrow functions, classes, and modern syntax. It does not transpile anything — the output is the same language version as the input.

Is my code uploaded anywhere? No. Everything runs locally in your browser.