Skip to content
All tools›Minifiers / Beautifiers›JavaScript Beautifier

JavaScript Beautifier

Formats JavaScript files with the chosen indentation level and brace style: collapsed or expanded.

Loading tool...

About the JavaScript beautifier

This tool takes minified, compressed or messy JavaScript and rewrites it with consistent indentation, one statement per line and a predictable placement of braces.

Brace styles

  • Collapsed (usual JavaScript): if (a) { b(); } else { c(); }
  • Expanded (Allman): brace on its own line.
  • Expanded new line: opening brace on same line, closing brace on new line.
  • Keep as-is: only fix indentation.

Options

Option Effect
Indentation level Spaces (or a tab) per block level.
Preserve existing line breaks Keeps blank lines for logical sections.
Space before anonymous function parentheses function () vs function().
Keep array indentation Preserves multi-line array formatting.
End with a newline Adds final line break for linters.
Comma-first style Comma at beginning of next line.
---