SQL Formatter
Pretty-print SQL with consistent indentation
About the SQL Formatter
Paste any SQL query — SELECT, INSERT, UPDATE, DELETE, CTEs — and get a cleanly indented version with major clauses on their own lines, AND/OR conditions stacked, and column lists broken across lines. Optionally uppercase keywords for visual contrast.
String literals and comments (-- and /* */) are preserved verbatim. The formatter is dialect-agnostic — it works for PostgreSQL, MySQL, SQLite, SQL Server, and Snowflake.
Frequently asked questions
Does it validate or execute the SQL?
No — only formats. Syntactically invalid SQL still gets indented; it just won't run. Use your database client to validate or run queries.
Are subqueries indented?
Yes. Subqueries inside parentheses are indented one level deeper, and major clauses inside them break onto their own lines as usual.