How to format SQL
- Paste your query. Several statements separated by semicolons are fine.
- Pick your database’s dialect and how keywords should look.
- Choose Format for readable SQL, or Minify to put it on one line.
Why format SQL?
- Each clause (
SELECT, FROM, WHERE, JOIN) on its own line makes long queries easy to read and review.
- Consistent formatting keeps diffs in code review small and clear.
Frequently asked questions
Which SQL dialects does it understand?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift and Spark SQL. Pick yours so dialect-specific syntax, like PostgreSQL casts or T-SQL brackets, is kept intact.
Does it change what my query does?
No. It only changes spacing, line breaks and, if you choose, the case of keywords. Table names, values and strings are kept exactly as they are.
Is my SQL sent anywhere?
No. Formatting happens in your browser, so it's safe for queries with table names or data you'd rather keep private.