SQL Formatter & Beautifier
Paste a messy SQL query and get a clean, readable layout with one clause per line. Your query never leaves your browser.
Free · Runs in your browser · Your text is never uploaded
Why format SQL?
A query written on one line is hard to review. Formatting puts each major clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY) on its own line, lists columns one per line, indents joins and conditions, and indents subqueries. That makes mistakes such as a missing join condition or a misplaced OR easy to spot.
What this formatter does
- Uppercases standard keywords (optional).
- Splits SELECT lists and SET lists one item per line.
- Puts AND and OR conditions on indented lines, and keeps
BETWEEN … AND …together. - Leaves strings, quoted identifiers and comments exactly as written.
It only changes whitespace and keyword case, never the meaning of the query. Vendor-specific syntax is passed through unchanged, so review the output before running it on important data.
Everything runs in your browser. Nothing you paste is uploaded, logged or stored, so it is safe to use with private data.
Related guides
Popular sql formatter presets
Frequently asked questions
How do I format a SQL query online?
Paste the query into the box. The formatted version appears instantly and can be copied.
Does formatting change what my query does?
No. Only spacing, line breaks and the case of keywords change. Strings and identifiers stay as they are.
Which SQL dialects are supported?
Standard SQL layout works for MySQL, PostgreSQL, SQL Server, SQLite and Oracle queries. Dialect-specific syntax is kept as written.
Is it safe to paste production queries?
The query is formatted in your browser and never uploaded. Remove real customer data from the query text if you plan to share it.