SQL Formatter

Format SQL queries instantly. Supports PostgreSQL, MySQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake. Free, no signup, runs in your browser.

SQL input
Awaiting input

About SQL Formatter

Frequently asked questions

Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server, Oracle, BigQuery, Snowflake, and Redshift. The formatter recognises common keywords across all these dialects. Dialect-specific syntax (e.g. PostgreSQL's RETURNING, BigQuery's STRUCT) passes through unchanged.

It places each top-level clause (SELECT, FROM, WHERE, GROUP BY, etc.) on its own line, breaks comma-separated lists onto multiple lines, indents nested expressions, normalises whitespace, and optionally upper/lower-cases keywords. The result is readable SQL that's easier to scan, review, and version-control.

No. Only whitespace and case are modified. Identifier names, string values, and the actual SQL semantics are preserved exactly. Pass the formatted query straight back to your database and it executes identically to the original.

Style preference — the SQL standard doesn't mandate case. UPPERCASE is the traditional choice and the most-readable for many people. lowercase is increasingly common in modern style guides and matches how some codebases prefer their SQL embedded in code. 'As-is' preserves what you typed.