About JSFormat
What this is
A JavaScript beautifier built on a tokenizer, running in your browser. Nothing you paste is uploaded.
What it guarantees
Every format passes three checks, and if any fails it returns your original code instead:
- The output tokenizes to the identical stream of tokens.
- Every line break in the input survives (it may add breaks, never remove one), because under automatic semicolon insertion a newline can be load-bearing.
- If the input compiles, the output compiles.
Strings, template literals, comments and regex literals are kept verbatim, including ones that contain braces, semicolons or //.
What it cannot do
It is not a parser. There is no AST, so long expressions are not wrapped sensibly, chained calls stay on one line, and JSX and TypeScript syntax are passed through as plain words and punctuation: it will not corrupt them, but it will not lay them out well. Use Prettier or Biome for that; this tool is for un-minifying a blob with nothing installed.
Companion tools
- ASI hazard checker: lines that start with
(,[, a template,+,-or/and silently join the previous statement; areturnfollowed by a line break. - Comment stripper: removes comments using the tokenizer, verifies the code tokens are unchanged, and can keep licence comments.
How it is tested
This engine is fuzzed against the JavaScript engine itself: thousands of generated inputs, with the rule that valid input must stay valid, plus a mutation check that injects known bugs and requires the fuzzer to catch them. The fuzzer evaluates the same script this page ships.