SQL Formatter & Beautifier
Paste a messy one-line query and get a clean, indented, readable SQL statement.
SQL Formatter
Runs in your browser — nothing you enter is uploaded or stored.
Scratchpad auto-saved
About the SQL Formatter
SQL that arrives as one long line — from a log, an ORM, or a colleague — is painful to read and review. Formatting it onto multiple lines with the major clauses aligned makes the query's structure obvious: what's being selected, from where, with which filters and ordering.
This formatter normalises whitespace, then puts each major clause (SELECT, FROM, WHERE, JOINs, GROUP BY, ORDER BY, and more) on its own line, indents AND/OR conditions and comma-separated columns, and can uppercase keywords in the conventional style. The result is a tidy, reviewable statement.
It's a lightweight beautifier that works well for typical SELECT/INSERT/UPDATE/DELETE statements and runs entirely in your browser — your queries, which may reference private schema, are never uploaded. Very complex nested queries may need a little manual polish.