SQL Formatter
Format a SQL query with uppercase keywords, a new line for each clause and consistent indents, so long queries are easy to read.
SQL Formatter lays out a SQL query with uppercase keywords, each major clause on its own line, one column per line and indented subqueries. It formats only: it does not check that the query is valid or will run.
What does a SQL formatter change?
Formatting, not validation
The formatter splits the query into words, strings, numbers and symbols and rebuilds the whitespace around them. Strings, quoted names and comments are kept exactly. It does not know your tables or your database dialect, so a typo is formatted, not flagged.
Why use SQL Formatter?
- Read long queries. SELECT, FROM, JOIN, WHERE, GROUP BY and ORDER BY each start a line, and AND and OR conditions line up beneath.
- Cleaner code reviews. Consistent formatting means diffs show real changes, not reshuffled spacing.
- Nothing leaves the page. Queries often reveal table names and data. Formatting happens in your browser.
How to use SQL Formatter, step by step

- Paste your query into SQL Formatter. One statement or several separated by semicolons.
- Choose indent and keyword case. Two spaces, four spaces or tabs, and whether keywords are uppercased.
- Copy the formatted SQL. Or download it as a .sql file.
Frequently asked questions
Which SQL dialects does it support?
It works on the common syntax shared by PostgreSQL, MySQL, SQLite and SQL Server. Unusual dialect features are left as written rather than reformatted.
Will it change my string values?
No. Anything in quotes, and comments, is copied exactly as it was.
Can it tell me why a query fails?
No. It is a formatter, not a validator. Run the query against your database to see real errors.
Looking for the long version? The guides cover each of these jobs in depth.