SQL Formatter
SQL → SQLMake an unreadable query readable, in the dialect you actually use.
Formatted query appears hereThe query is tokenised rather than pattern-matched, so string literals, quoted identifiers and comments are left exactly as written — a regex-based formatter will happily change the capitalisation inside your WHERE clause’s text.
About SQL Formatter
Paste a query that arrived as one long line — out of a log, an ORM, or a colleague's message — and get it back indented and readable. Fourteen dialects are offered, from standard SQL through PostgreSQL, MySQL, SQL Server and Oracle to BigQuery, Snowflake and ClickHouse, because each has keywords and quoting rules the others do not.
The formatting is done by tokenising the query, not by matching patterns, and that is the distinction that matters. A regex-based formatter cannot tell the difference between the keyword `from` and the word "from" inside a string literal, so it will change the capitalisation of your data or break an identifier that happens to contain a keyword. Here, literals, quoted identifiers and comments come through exactly as written.
Choosing the right dialect is worth a moment: it decides how `[bracketed]` or `` `backtick` `` identifiers are read, and which words count as keywords. If output looks subtly wrong, the dialect is usually why.
Common questions
This page does the work itself, in this tab. Nothing you paste is sent to a server. Close the tab and no copy remains.