JavaScript Formatter

Paste minified or badly indented JavaScript to get clean, consistently formatted code. Choose spaces or tabs, collapse or Allman-style braces and an optional wrap length; modern syntax such as arrow functions, template literals and async/await is supported. A quick check warns when brackets look unbalanced.

How to use the JavaScript Formatter

  1. Paste your code or press Load example.
  2. Set indentation, brace style and wrap length.
  3. Press Format JavaScript.
  4. Copy the formatted code or download it as a .js file.

Features

Benefits

Frequently asked questions

Can it restore the original variable names?

No. Formatting only adds whitespace and line breaks. Names that were shortened by a minifier stay shortened.

Does it work with TypeScript?

Most TypeScript formats acceptably because it shares JavaScript syntax, but type-specific constructs such as generics may not always indent ideally.

Does it check that my code runs?

It is a formatter, not a compiler. It warns about unbalanced brackets but does not execute or fully parse the code.

Related tools