FormatBento

Code formatters & beautifiers

FormatBentoSQL

SQL formatter

Turn one-line queries into readable SQL. Pick your database's dialect, choose how keywords are cased and indented, and copy the result. Powered by sql-formatter, running in your browser.

Empty
Output

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

Syntax error


						
					
Options

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

Runs in your browser · nothing is uploaded

How to format SQL

Choose the dialect your database speaks, then paste one query or a whole script. Statements separated by semicolons are formatted one after another. A parse error points at the exact line and column, which often reveals a dialect mismatch, such as MySQL backticks under PostgreSQL.

Keywords, data types, functions
Upper-case, lower-case or leave as written. Identifiers and string literals are never changed.
Indent style
Standard puts clauses on their own lines; tabular aligns everything after SELECT, FROM and WHERE in a column.
Expression width
Parenthesised expressions shorter than this stay on one line.
Dense operators
Writes a+b instead of a + b.

Questions

Does formatting change what my query does?

No. Only whitespace and the case of keywords, data types and functions change. Comments, quoted identifiers, strings and parameters such as $1, ? or @id are kept.

Why does my query fail to parse?

Usually the dialect: each one knows its own quoting, operators and keywords. Try your database's dialect, or Standard SQL for portable code. Procedural blocks are formatted as statements, not fully restructured.

Is my SQL sent to a server?

No. The formatter is downloaded once and runs in this tab, so queries with real table names or data never leave your machine.