SQL Formatter

Format SQL queries so they are readable — or minify them.

DeveloperFreeNo sign-up
Loading tool…

Runs entirely in your browser — nothing you enter is uploaded or stored on a server.

How to use it

Format SQL with each clause on its own line, columns and conditions one per line, joins aligned and subqueries indented, keywords in upper or lower case — or minify a query onto one line. Strings and identifiers are never changed.

  1. Paste a query.
  2. Choose keyword case and indent.
  3. Copy the formatted SQL.
DevelopersAnalystsData engineers

Questions

Which SQL dialects work?

Standard SQL and the common dialects — MySQL, PostgreSQL (including $$ strings and :: casts), SQL Server ([brackets]), SQLite and BigQuery.

Does it check my SQL is valid?

No — it formats what it is given. A query with a typo is formatted too, which often makes the typo easier to spot.