JavaScript Formatter
runs in your browserno sign-upfree
Format and beautify JavaScript (including JSX) with Prettier for better readability.
Formatting…
About this tool
This JavaScript formatter beautifies minified or inconsistent code into clean, readable JavaScript using Prettier. It supports modern syntax (ES2024), JSX and Flow, and lets you choose single or double quotes, semicolons and indentation.
How to use
- Paste your JavaScript into the Input box.
- Choose indent, line width, quote style and whether to use semicolons.
- Copy the formatted code or download it as a .js file.
FAQ
Which formatter is used?
Prettier, the most widely used code formatter for web projects. It runs entirely in your browser, so your code is never uploaded.
Does it work with TypeScript?
This page uses the JavaScript (Babel) parser, which also understands JSX. Most simple TypeScript formats fine, but type-only syntax may report an error.
What happens if my code has a syntax error?
The status line shows the problem with its line and column, and the error is marked in the editor. Fix it and the formatted result appears straight away.