Skip to content

SQL Formatter

Format SQL for MySQL, PostgreSQL, SQLite and more

SQL input

Paste one or more SQL statements

Formatted SQL

Formatted SQL appears here

How to use

  1. Paste your SQL. It is formatted as you type.
  2. Choose the dialect, keyword case and indentation.
  3. Click Format to replace the input, or copy and download the result.

Readable SQL for reviews and debugging

Long queries generated by ORMs or copied from logs are painful to read on one line. The formatter understands the grammar of each dialect and places clauses, joins, conditions and subqueries on their own indented lines, with consistent keyword casing. Use One line mode to collapse a formatted query back for logging or embedding in code.

Frequently asked questions

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL, Hive, Trino/Presto, IBM DB2, Couchbase N1QL and SingleStore. Pick the dialect so vendor-specific keywords and operators are recognized.