JavaScript Minifier

Strip comments and unneeded whitespace from JavaScript to cut file size, while keeping strings, template literals, and regex expressions byte-identical.

A JavaScript minifier removes comments and whitespace that sits between tokens where it changes nothing. Strings, template literals, and regex literals are tokenised first and copied through untouched.

Output

                

Paste or type something above.

Questions about javascript minifier

Is the output safe to run?
The minifier only removes whitespace and comments, so behaviour is unchanged. It is not a bundler and will not rename or tree-shake.
What about ASI and semicolons?
A space is preserved wherever two identifier characters would otherwise merge, and statement-ending semicolons are kept.
Does it handle modern syntax?
Yes, including template literals, optional chaining, nullish coalescing, and class fields, since only whitespace is touched.