Code Formatter
Paste HTML, CSS, JavaScript, TypeScript, or JSON and click Format to get clean, consistently indented code powered by Prettier.
How to code Formatter
- Select the language from the dropdown.
- Paste your code into the input area.
- Click "Format" — Prettier runs in your browser.
- Copy the formatted output or keep editing.
Private by design — Prettier runs in your browser using WebAssembly. Your code is never uploaded to a server.
Related tools
Frequently asked questions
Which Prettier version is used?
The formatter uses the latest version of Prettier bundled with this page. It runs entirely client-side via the Prettier standalone build.
Why does formatting fail sometimes?
Prettier requires syntactically valid code. If your code has parse errors, the formatter will show an inline error message describing the problem.
Can I format minified code?
Yes — minified JavaScript, CSS, and JSON will be expanded and re-indented. HTML minification reversal also works.
Is TypeScript supported?
Yes. Select TypeScript from the dropdown and Prettier will use its TypeScript parser, which handles JSX, generics, decorators, and more.