JavaScript Minifier

Reduce JavaScript file size by stripping comments and collapsing whitespace - while leaving strings, template literals, regexes and operators untouched.

Updated September 2026 · Written and verified by Akash Pandey

JavaScript Minifier

Before0 B
After0 B
Saved
Minified

How to use the JS minifier

  1. Paste your JavaScript into the input.
  2. Choose whether to keep license comments (a common legal requirement).
  3. Click Minify - you get size savings plus a token-balance check that flags obvious syntax problems.

Frequently asked questions

Is it safe for any JavaScript?

It only removes comments and collapses whitespace runs, and it scans tokens to keep strings, template literals and regular-expression literals intact - so your code's meaning never changes.

Why does it not rename variables?

Renaming (the biggest wins for large code) needs a full parser/scope analysis. This tool deliberately trades a little size for safety; the FAQ notes tools like terser/esbuild for production builds.

What happens to license comments?

They are removed by default but kept if you enable the option - which is worth doing for MIT/Apache headers.

How are regex literals and template literals protected?

The tokenizer tracks backticks, quotes and slash contexts, so a regex like /\s+/ is never truncated or merged with the following code.

What does the syntax check do?

It balances braces, brackets and parentheses and reports an error with a position when they mismatch, catching copy-and-paste damage before you deploy.

Will it work on ES modules?

Yes - modern syntax (import/export, optional chaining, arrow functions) passes through unchanged.

Does this minifier rename variables or functions?

No. It is a safe, non-destructive minifier that strips comments and compacts whitespace without renaming variables, avoiding scope bugs.

Can I preserve copyright and open-source license comments?

Yes. Checking the "Keep license comments" option preserves comments beginning with /*!, ensuring compliance with open-source licenses.