How to Format a SQL Query
Three steps. (1) Paste your raw SQL — a single line, a multi-statement script, or a messy hand-edited query — into the input box. (2) Click Format SQL. (3) Copy the beautified result. The formatter tokenises the statement, recognises SQL keywords case-insensitively, and rebuilds the query: top-level clauses start a new line at zero indent, the columns after SELECT are indented one level and split on commas, each JOIN and its ON condition gets its own line, and boolean operators (AND, OR) in the WHERE clause are aligned for easy scanning. Parentheses for sub-queries and function calls increase the indent so nested logic is visually obvious. String literals and quoted identifiers are preserved verbatim, so your data and column names are never altered — only the surrounding whitespace and keyword casing change.