SQL formatter online

Turn a dense query into something a teammate can review before it becomes a migration, report, or production fix.

Dialect:
Indent:
Keywords:
Input SQL
Formatted output
Waiting for input...

Why format SQL?

Dense SQL is where small mistakes hide: the wrong join, a missing parenthesis, a filter attached to the wrong clause, or an alias that looked obvious yesterday. Formatting does not make a query correct, but it makes the intent visible enough to review.

Readable structure: Consistent indentation and line breaks make SELECT lists, joins, subqueries, CTEs, and WHERE conditions easier to follow.
Team consistency: A shared formatting style reduces review noise in migrations, dashboards, analytics notebooks, and stored query libraries.
Faster debugging: A cleaner layout makes logical mistakes, missing aliases, misplaced AND/OR groups, and broken conditions easier to spot.
Diff-friendly changes: Stable line breaks make it easier to review query edits in pull requests instead of reading a wall of one-line SQL.

Dialect quick reference

DialectCommon traitsRecommended setting
Standard SQLGeneral-purpose baseline for simple relational queries.Uppercase keywords, 2-space indentation
MySQL / MariaDBBackticks, LIMIT clauses, and MySQL-specific syntax.MySQL dialect
PostgreSQL$tag$ strings, JSONB operators, and cast-heavy syntax.PostgreSQL dialect
Transact-SQL (T-SQL)Square-bracket identifiers, TOP clauses, and SQL Server syntax.T-SQL dialect

Frequently asked questions

Does this upload my SQL to a server?

No. Formatting happens in the browser, so the query text stays on the page.

How do I reformat minified SQL?

Paste the one-line query into the input pane and choose the closest dialect. The formatter will rebuild line breaks, indentation, and keyword casing automatically.

Can formatting change how a query runs?

Whitespace and keyword casing should not change SQL semantics. Still, treat formatted output as code: review it, run tests, and be careful around dialect-specific syntax.

Which SQL dialect should I choose?

Choose the database that will execute the query. PostgreSQL, MySQL, and SQL Server have different quoting rules, functions, casts, and limit syntax, so the closest dialect gives the cleanest result.