JavaScript Formatter

Turn minified or hand-mangled JavaScript back into clean, consistently indented code.

About this tool

This beautifier tokenizes your JavaScript first — so string literals, template literals with ${} expressions, regular expressions and comments are recognised and preserved byte-for-byte — and then re-indents the code block by block: statements after semicolons, braces on their own lines, case labels dedented inside switch, and callbacks inside calls indented correctly.

How to use it

  1. Paste your JavaScript, or click Sample to see a formatted example.
  2. Choose your indentation and click Format JavaScript.
  3. Copy the result back into your project.

Good to know

  • The formatter never evaluates your code — pasting is safe even for sensitive snippets.
  • Multi-line expressions are kept on one line where the source had them on one line; long chains formatted across lines stay across lines.
  • It is a formatter, not a linter: it will not detect bugs or unused variables.