Code · Made a little simpler

JavaScript Beautifier

Format JavaScript locally with two, four or eight spaces. Adjust the preferred line width, inspect syntax errors and download a readable JavaScript file.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

JavaScript Beautifier: how to use it

  1. Paste JavaScript or choose a local source file.
  2. Choose the indentation and preferred print width, then select Format JavaScript.
  3. Read the formatted source and copy it or download formatted.js.

Limits and notes

Input can contain up to 1,000,000 UTF-16 code units. Local files must be valid UTF-8 and at most 4 MiB. Uses the Babel parser and Prettier formatting rules. Output uses LF line endings. Print width guides wrapping and long tokens can exceed it.

How your privacy works →

JavaScript Beautifier: common questions

Does the formatter run my JavaScript?

A browser worker parses the source and prints it as text. A pasted statement or function is never executed.

Can I choose four-space indentation?

Select 4 spaces before formatting. The setting applies at every indentation level.

Guides