JavaScript Formatter
Re-flow JavaScript locally on braces and semicolons: pretty mode wraps and indents, minify mode drops comments and collapses code whitespace while keeping required token separation; whitespace inside strings, template literals and comments is preserved verbatim.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Result
The result can be copied directly.
Enter JavaScript code to see the formatted result
Characters: 0 · Lines: 0
What this tool does
- Expand bundled minified code into readable multi-line structure.
- Normalise formatting before committing so diffs show real changes only.
- Minify back to one line to estimate the shipped size.
Example
Input
function f(){var s="a b";return s}Output
function f() {
var s="a b";
return s
}Indentation follows braces and semicolons; whitespace inside strings, template literals and comments is kept verbatim.
Frequently asked questions
Is whitespace inside strings collapsed?
No. A lexical scanner separates code, strings, template literals and comments so only code is re-flowed; `"a b"` keeps both spaces.
What about unterminated quotes?
It fails with `unterminated-token`: the boundary cannot be determined, and guessing would swallow the following code.
Is this a semantic formatter?
No. It re-flows on braces and semicolons without parsing an AST: structure is safe, but there is no width-based wrapping.
Which indents are supported?
2 spaces, 4 spaces and tabs.
Keywords:format-jsformatconverterdeveloper