About this tool
Paste a query copied from a log file or an ORM and get it back with one clause per line, aligned joins and consistent keyword casing. Choosing the right dialect lets the formatter understand syntax such as PostgreSQL casts, T-SQL brackets or BigQuery backticks. The result is syntax-highlighted, and all formatting runs locally in your browser.
How to use SQL Formatter
- Paste your SQL into the left box.
- Choose the database dialect.
- Pick keyword casing and indentation.
- Copy the formatted query or download it as a .sql file.
Frequently asked questions
Does formatting change what my query does?
No. Only whitespace, line breaks and keyword casing change. Identifiers, string literals and the order of clauses stay exactly as you wrote them.
Why do I get a parse error?
The formatter needs syntax it recognises. Try the dialect that matches your database, and check for unbalanced quotes or brackets.
Can it format several statements at once?
Yes. Separate statements with semicolons and each one is formatted, with a blank line between them.