JavaScript Formatter and Beautifier
Turn a minified script or a wall of code into something you can read and debug. Statements get their own lines, blocks are indented, and spacing is made consistent.
How to format JavaScript
- 1Paste your JavaScript or open a .js file.
- 2Choose the indent and where braces go.
- 3Copy the formatted code or download it.
Minified code
Formatting restores the structure of minified code, but not its original names: variables shortened to a, b and c stay short. It's still far easier to follow and to set breakpoints in.
Modern syntax
Arrow functions, classes, template literals, async and await, and modules all format correctly. JSON formats too.
Braces
Keep opening braces on the same line, the most common style, or put them on their own line.
Frequently asked questions
- Is my code uploaded?
- No. Everything runs in your browser, so your code never leaves your device.
- Does it support TypeScript?
- TypeScript usually formats well, since most of it looks like JavaScript, but it isn't fully supported.
- Will formatting change what the code does?
- No. Only whitespace and line breaks change.