SQL Formatter
Format an unreadable one-line query into indented SQL, with keywords aligned so the structure is visible.
Result
Only whitespace and keyword casing change — string literals, quoted identifiers and comments are copied through untouched. It formats on structure rather than parsing a grammar, so it is dialect-agnostic and will happily format a query that does not run.
Runs entirely in your browser — nothing you paste is uploaded or stored.
About sql formatter
Queries that arrive from an ORM log or an application trace are usually a single long line. Breaking them at the clause boundaries and indenting the subqueries is the difference between guessing at a query and reading it.
The formatter puts each major clause on its own line, indents nested parentheses, and normalises keyword case, while leaving string literals and quoted identifiers exactly as they were.
Good to know
- String literals, quoted identifiers and comments are preserved verbatim — formatting never rewrites the contents of your data.
- Keyword case can be uppercased, lowercased, or left alone if your team has its own convention.
- This is a formatter, not a parser or a linter. It will happily format a query with a syntax error, and it does not validate table or column names.