JavaScript Formatter
Beautify JavaScript and JSX with Prettier. Choose indentation, quotes and semicolons.
About the JavaScript Formatter
The JavaScript Formatter applies Prettier, the formatter most JavaScript projects use, so code looks the same no matter who wrote it. It handles modern syntax and JSX.
Everything runs in your browser, so your input is never uploaded to a server.
How to use the JavaScript Formatter
- Paste JavaScript or JSX, or open a file.
- Set indentation, single or double quotes, semicolons and line width.
- Copy or download the formatted code.
Frequently asked questions
Is the output the same as running Prettier locally?
Yes, it uses Prettier itself with the options you choose, so the result matches a project configured the same way.
Can it fix syntax errors?
No. Code must parse before it can be formatted; the error message shows where parsing failed.
Related tools
JSON Formatter
Format and beautify JSON with configurable indentation and optional key sorting. Errors are reported with exact line and column.
HTML Formatter
Beautify messy or minified HTML into clean, indented markup using Prettier, right in your browser.
CSS Formatter
Format CSS, SCSS and Less stylesheets into readable, consistently indented code.
TypeScript Formatter
Format TypeScript and TSX code with Prettier, including types, generics and decorators.
PHP Formatter
Beautify PHP code following PSR-style formatting with the Prettier PHP plugin.
SQL Formatter
Format SQL queries for MySQL, PostgreSQL, SQLite, SQL Server and more with keyword casing options.