Home SQL formatter
SQL formatter
Choose standard SQL, MySQL, PostgreSQL, SQL Server, Oracle, SQLite, or BigQuery.
Why this exists
A SELECT stuck on one line makes JOIN and WHERE easy to miss.
A dialect lays the keywords and line breaks of that grammar back down, and a bad bracket is named by its line and column.
-
01How to use it
Paste a query, then pick the dialect, the keyword shape, and the indent.
Example drops in a SELECT with JOIN, WHERE, and GROUP BY.
-
02What you get
The result uses the line breaks and keyword shape of the chosen dialect.
A bad spot names its line and column. If the spot cannot be found, the page asks you to check the grammar and the dialect.
EnteredSELECT
keyword UPPER indent 2 -
03Worth knowing
Whitespace alone clears the result and the note.
Over 1MB, the page shows that it may take a moment only while it is working, then clears that sentence.
Questions
- QDoes the query leave this browser?
- ANo. Formatting finishes in this browser.
- QCan keywords keep the case I typed?
- AChoose Keep and the case stays as written.
- QWhat if a bracket is left open?
- AThe page names the line and the column. If it cannot, it also asks you to check the dialect.
How this page works it out
This page lines up SQL for the dialect you pick, including keyword case and indent.
A new line starts when a clause such as SELECT, FROM, WHERE, or JOIN changes. Keywords can be upper case, lower case, or left as typed. Indent is two spaces or four. If a bracket or quote is left open, the page names the nearby line and column.
A statement that is too large asks to be split. A different dialect can break the same statement on different lines. The statement is formatted only in this browser.