FAQ
Will template strings and regex be broken?
No. Strings, template literals, regex literals and comments are handled by syntax boundaries, so backticks and slashes inside them are not mistaken for code.
Does minify remove comments?
Yes. Minify strips comments and extra whitespace, so use beautify if you want to keep them.
Does it report syntax errors?
It surfaces syntax hints, but a beautifier is not a full linter. Logic errors still need an IDE.
About this tool
Indentation is 2 spaces, { follows the statement it opens, } gets its own line, and } else / } catch stay on the same line as the closing brace. Comments get a line of their own, while short objects and arrays stay inline — the goal is readability, not one token per line.
Tokenising follows syntax boundaries: strings, template literals (the ${} expression inside is skipped by counting braces), regex literals and comments are all treated as whole units, so backticks inside a template and slashes inside a regex are never mistaken for code. A space is inserted before the parenthesis of if / for / while, while function calls keep their parenthesis attached.
The syntax hint compiles the input with new Function, so it treats your code as a function body: top-level import / export will be flagged (module syntax cannot appear in a function body), while a top-level return will not. When you see such a hint, check whether the file is an ES module before editing anything. This is not a linter either — logic errors and undefined variables are never reported.
Minifying is token-based: comments and whitespace are dropped, and a single space is kept only where two tokens would otherwise fuse — return before an identifier, a number before an identifier, and adjacent operators such as a - -b (without the space it becomes a--b, a decrement, which changes the meaning). JSX and TypeScript type syntax are out of scope and may come out mangled; use the dedicated toolchain for those files.