JS Formatter

Beautify and indent JavaScript

Format minified or messy JavaScript (and JSON) into readable, indented code, with brace style, blank-line and line-wrap options.
Try an example:

Output will appear here...

About JS Formatter

How it works

  1. The code is tokenised by js-beautify.
  2. Blocks are indented, statements are placed on their own lines and spacing around operators is normalised.
  3. Brace style decides where { goes.

What you need

  • JavaScript code. Minified code works too.

Tips

  • Formatting does not restore original variable names from minified code - but it makes the structure readable.

Runs in your browser. Everything happens in your browser - your code and data are never uploaded.

Frequently asked questions

What is the difference between a formatter and a linter?+

A formatter only changes layout (indentation, spacing, line breaks). A linter checks for likely bugs and style rule violations.