SQL Formatter
Beautify and indent SQL queries.
Loading tool…
How to use SQL Formatter
Paste the SQL query you want to clean up.
Choose whether keywords should be uppercased.
Copy the formatted query straight back into your editor.
Frequently Asked Questions
Which SQL dialects work?
The formatter is dialect-agnostic and works with MySQL, PostgreSQL, SQL Server, SQLite and BigQuery, since it only re-lays-out standard clauses and keywords.
Does it change what my query does?
No. Only whitespace and keyword casing change; identifiers, string literals and the order of clauses stay exactly as you wrote them.
Can I format several statements at once?
Yes. Statements separated by semicolons are each laid out on their own lines, which makes reviewing a migration script much easier.
Related tools
Looking for something else? Browse all developer tools.