SQL Formatter
Paste a messy SQL query and format it into clean, consistently indented SQL — with dialect-aware handling for PostgreSQL, MySQL, SQLite, SQL Server and BigQuery.
Try next
Your files are processed locally in your browser. They are not uploaded to our servers.
How to use
- Paste your SQL query into the input box.
- Pick your SQL dialect and choose whether keywords should be uppercased.
- Click Format SQL and copy the result.
What is this tool?
SQL Formatter re-indents and restructures SQL statements so they're easy to read and review: one clause per line, nested subqueries indented, keywords optionally uppercased. It understands the syntax quirks of the major dialects — PostgreSQL, MySQL, SQLite, SQL Server (T-SQL) and BigQuery — so dialect-specific constructs format correctly. Formatting runs entirely in your browser; your queries and any data in them are never uploaded.
Common uses
- Cleaning up a long query copied from application logs
- Making generated SQL from an ORM readable before debugging it
- Standardizing query style before committing it to a code base
- Reading and understanding someone else's one-line query
FAQ
Does formatting change what the query does?
No, only whitespace and keyword casing are changed. The statement's logic and semantics stay exactly the same.
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server (T-SQL) and BigQuery.
Can it format multiple statements at once?
Yes, paste several statements separated by semicolons and they'll all be formatted.
Is my SQL sent to a server?
No, formatting runs entirely in your browser — queries, table names and data never leave your device.