Loading Formatter...

Format code with Prettier, without installing it

Pick a language, paste the code and press format. The output comes from Prettier, the same formatter most editors run on save, so the result matches what a project using Prettier defaults would produce: two-space indentation, consistent quotes and wrapped long lines. Nine languages are supported: JSON, JavaScript, TypeScript, HTML, CSS, XML and SVG, YAML, Markdown and GraphQL.

After formatting, the original and the result sit side by side. Either pane collapses, the original can be viewed with foldable blocks or switched back to an editable text area, and the copy button takes the formatted version. If the input does not parse, the error names the language and quotes the first line of Prettier's message, which usually points at the exact character that broke it; a trailing comma in JSON is the usual suspect.

A second tab opens the diff checker, so two versions of a snippet can be compared in the same place. Formatting runs in the browser: Prettier's parsers are loaded as part of the page and the code is not posted to a server, which matters when the snippet is a config file with credentials in it.

Frequently asked questions

Does it minify code as well as beautify it?

No. It only formats for readability. For minification use a build tool such as esbuild or terser, which also handle dead-code removal and source maps.

Can I change the indentation or quote style?

Not here. The formatter runs with Prettier's defaults: two spaces, double quotes in JavaScript and an 80-column print width. If your project uses a .prettierrc, run Prettier locally for an exact match.

Why does valid-looking JSON fail to format?

JSON is stricter than JavaScript: no trailing commas, no single quotes, no comments and no unquoted keys. The error message quotes the line where parsing stopped, which is usually just after the offending character.

Which languages are not supported?

Python, Java, C#, Go, SQL, PHP and Rust are not available, because Prettier has no built-in parser for them. The list is JSON, JavaScript, TypeScript, HTML, CSS, XML, YAML, Markdown and GraphQL.