JavaScript beautifier

Paste JavaScript to arrange its whitespace, blocks and statements.

JavaScript beautifier

Up to 1 MB of text.

Result

Formatted JavaScript
function greet(name) {
  const message = "Hello, " + name;
  return message;
}

How it is calculated

  1. Strings, comments and regular expressions are kept together.
  2. Blocks and statements are reindented with two spaces.
  3. Formatting runs locally in your browser.

Example

function greet(name){const message="Hello, "+name;return message;}

Good to know

  • The formatter improves layout but does not compile or validate JavaScript.
  • Some complex styles may need manual adjustment.

Frequently asked questions

What is this tool used for?

Paste JavaScript to arrange its whitespace, blocks and statements.

How is the result calculated?

Strings, comments and regular expressions are kept together.

What should I check before using the result?

The formatter improves layout but does not compile or validate JavaScript.

Updated October 11, 2026

Indicative result. For an important decision, check with a professional.