Paste any SQL query to auto-indent and prettify it. Choose keyword casing, indentation style, and SQL dialect. All formatting happens in your browser — your queries never leave your machine.
Raw SQL from ORMs, query logs, or minified sources is often a single dense line with no whitespace — impossible to read or debug. A well-formatted query makes the SELECT list, JOIN conditions, WHERE clauses, and ORDER BY expressions immediately visible as distinct logical sections. This dramatically reduces the time to understand or modify a query, especially as complexity grows.
Consistent SQL style also matters in team environments. When every developer formats queries the same way — uppercase keywords, 4-space indentation, trailing commas — code reviews focus on logic rather than aesthetics. Many teams enforce SQL formatting in their CI pipelines alongside linting for application code. This free tool handles the formatting instantly so you can focus on writing good queries.
SELECT, FROM, WHERE, JOIN on new lines
AND, OR) on their own lines
.sql
LIMIT x,y syntax
ILIKE, CTEs
TOP, NOCOUNT
col1,)
, col2)
Good SQL style is more than just pretty-printing. Capitalising SQL keywords (SELECT, FROM, WHERE) makes them visually distinct from table names and column identifiers, which is the most widely used convention. Placing each major clause on its own line — and indenting the items that belong to it — lets you scan the query structure at a glance. For SELECT lists with multiple columns, one column per line makes it trivial to add, remove, or comment out a column without touching surrounding lines.
For WHERE clauses with multiple conditions, placing AND / OR at the beginning of each new line is common because it draws attention to the logical operator and makes the structure of compound conditions easier to follow. The same principle applies to JOIN conditions with ON. Consistent formatting across your codebase also helps tools like sqlfluff or pgFormatter enforce style in CI pipelines.