SQL Formatter
Paste a SQL query to lay it out with one clause per line and consistent indentation. Pick your dialect so quoting and operators are read correctly.
Runs in your browser — nothing is uploaded.
How to use it
- Paste your SQL and choose the dialect: MySQL, PostgreSQL, SQLite or T-SQL.
- The query is formatted as you type. Choose upper-case, lower-case or unchanged keywords, and the indentation.
- If the query cannot be read, the message gives the line and column to look at, and a dialect mismatch is the most common cause.
- Copy the result or download it as a .sql file.
Frequently asked questions
Is my query uploaded?
No. The formatting runs in your browser and the query is never sent anywhere, so it is fine to paste real table names.
Does it run or validate my SQL?
No. It only lays the text out. It does not connect to a database, and a query that formats fine can still fail on your server.
Why do I get a parse error on valid SQL?
Usually the dialect does not match: backticks belong to MySQL, [brackets] to T-SQL, :: casts and $1 parameters to PostgreSQL. Switch the dialect and try again.
Are strings and comments changed?
No. String literals, quoted identifiers and comments are kept exactly as written. Only keyword case and whitespace change.
Can it format several statements at once?
Yes. Statements separated by semicolons are formatted one after another with a blank line between them.