Developer tool

SQL Formatter

Beautify SQL queries for MySQL, PostgreSQL and more.

Free Runs in your browser

About this tool

SQL Formatter turns a long one-line query into clean, indented SQL that is easy to read and review. Pick your database dialect so its keywords and syntax are handled correctly.

How to use SQL Formatter

  1. Paste your SQL query.
  2. Choose the dialect, keyword case and indent.
  3. Copy the formatted SQL.

Questions people ask

Which databases are supported?

Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift and Spark SQL.

Does formatting change what the query does?

No. Only whitespace, line breaks and optionally keyword case change. Strings, identifiers and logic stay the same.

Why does formatting fail?

The parser stops on syntax it does not know, such as a typo or a feature from another dialect. Try a different dialect or fix the line it reports.

More developer tools

See all 24 →
Esc