Home / Dev Tools / Code Tools / JS Minifier

JS Minifier

Minify JavaScript code to reduce file size directly in your browser.
JavaScript Input
Minified Output

Runs entirely in your browser — your code is never uploaded to a server. Performs safe, conservative minification: removes comments and unnecessary whitespace, tightens spacing around braces/parens/brackets/semicolons/commas, and preserves the exact content of strings, template literals, and regex literals. It does not rename variables, eliminate dead code, or fully parse JavaScript grammar — for maximum compression, use a dedicated tool like Terser. Avoid relying on automatic-semicolon-insertion patterns (e.g. a bare return followed immediately by a newline and then { or [) in code you minify here, since whitespace collapsing could change behavior in those specific cases.

Frequently Asked Questions

No — this performs safe, conservative minification (removing comments and unnecessary whitespace) rather than full optimization. For maximum compression, a dedicated tool like Terser is more appropriate.

Mostly, but avoid patterns like a bare return followed immediately by a newline and then a brace — whitespace collapsing could change behavior in that specific edge case.

Yes — it uses a preceding-token heuristic to distinguish regex literals (like /abc/g) from division operators.

Found this useful? Share it:
Quick Feedback