FormatBento

Code formatters & beautifiers

PrettierSQLXMLin your browser

Code formatter & beautifier

Paste JavaScript, TypeScript, JSON, CSS, HTML, Vue, Markdown, YAML, GraphQL, SQL or XML. It detects the language and formats the code in your browser; nothing is uploaded.

Detects the language as you paste
Empty
Output

The formatted code lands in this compartment. Ctrl + Enter formats from the keyboard.

Syntax error


						
					
Options Prettier's names and defaults

Ready. Paste code, open a file or press Sample.

Runs in your browser · nothing is uploaded

How to use it

Paste code into the left compartment, drop a file on it, or press Sample to cycle through examples in every language. With Format on paste on, pasted code is formatted straight away; otherwise press Format or Ctrl + Enter. Changing an option re-formats the current code. Download saves the result with the right extension, using the opened file's name when there is one.

Language notes

JavaScript, JSX, TypeScript and TSX
Prettier's Babel and TypeScript parsers. TypeScript is parsed without JSX so <T>value casts work; pick TSX for components.
JSON
Prettier's JSON printer keeps key order and comments. If the JSON is actually broken (single quotes, trailing commas, missing brackets), JSONMender repairs it first.
HTML, Vue and Markdown
Scripts, styles and fenced code blocks inside them are formatted too, with the plugin for their language.
SQL and XML
Formatted with sql-formatter (standard SQL, upper-case keywords) and FormatBento's own lossless XML printer. Their pages add dialects, keyword case, minifying and attribute wrapping.

One compartment per language

Dedicated formatters with the options each language really needs.

Questions

Is my code uploaded anywhere?

No. Prettier, sql-formatter and the XML printer run as JavaScript in this tab. The formatter for a language is downloaded from this site the first time you use it; after that nothing is fetched. The site counts page views with Cloudflare Web Analytics, which sets no cookies and never receives what you paste.

How does auto-detect decide the language?

JSON is tried with a strict parser first, markup is judged by its first tag, SQL by its opening keyword and GraphQL by operations and type definitions. Everything else is scored on signals such as type annotations, selectors and key: value lines. Opened files use their extension. When it guesses wrong, pick the language from the menu.

Is the output the same as running Prettier myself?

Yes. This is Prettier 3's own standalone build with its official plugins, so the same options give the same output as the command line. A .prettierrc file is not read, so set print width, quotes and the rest here; your choices are remembered in this browser.

Which options apply to which languages?

Print width, tab width and tabs apply everywhere. Semicolons and trailing commas affect JavaScript and TypeScript, including scripts inside HTML and Vue. Single quotes also apply to CSS and YAML strings, and bracket spacing to objects in JavaScript, JSON, YAML and GraphQL.

Why do I get an error instead of formatted code?

A formatter has to parse code before it can print it, so it needs valid syntax. The error panel shows the line and column, the offending line with a caret under the problem, and a button that puts the cursor there. If the language guess was wrong, picking the right one usually fixes it.