Free SQL Formatter & Beautifier
Turn a cramped one-line SQL query into clean, consistently indented SQL. This formatter breaks queries at the major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, and more) and aligns them for easy reading.
How to Use
Paste your SQL and click Format Query. Choose the indentation size and whether keywords should be upper- or lower-case. Select Minify to collapse the query back to a single line.
- Breaks queries at SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, etc.
- Uppercase / lowercase keyword normalization
- Adjustable indentation (2, 4, or tab)
- Minify mode to condense a query to one line
What the formatter handles
The formatter understands the standard SQL structure, splits comma-separated column lists, indents JOIN conditions and sub-clauses, and normalizes a broad set of common keywords (SELECT, INSERT, UPDATE, DELETE, CREATE, JOIN, ON, AND, OR, and many more). String literals and comments are preserved as-is.
Related Developer Tools
You might also need
Tools from other categories that people pair with the SQL Formatter: