JS Beautifier / Minifier

Indent JS by braces for beautifying; protect strings when minifying

How to use

Minification uses a character-by-character state machine. When it meets strings, template literals, // and /* */ comments, it keeps them intact, so it never breaks spaces or content inside strings.

FAQ

Does minify strip comments and line breaks?

Yes, and it merges excess whitespace where possible, but keeps a single space only when still needed to separate adjacent identifiers, ensuring syntactic correctness.

Why not as aggressive as ready-made minifiers?

This tool runs purely in the browser with zero dependencies; its goal is "safe, no errors" and it will not perform aggressive optimizations like variable renaming that could change scoping.