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.
Format a compact JavaScript function
Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device
JavaScript Beautifier: how to use it
- Paste JavaScript or choose a local source file.
- Choose the indentation and preferred print width, then select Format JavaScript.
- 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.