SQL Formatter

Turn a one-line query into readable SQL, with the keywords lined up.

Fonctionne dans votre navigateurGratuit · sans inscription

À propos de SQL Formatter

Paste a query and get it back on sensible lines: each major clause starts a new line, joins and conditions are indented, and the keywords can be put in capitals. Strings and quoted names are left exactly as they were. Useful for a query pulled out of a log or an ORM.

Cet outil fonctionne dans votre navigateur : vos fichiers ne quittent jamais votre appareil.

Comment utiliser SQL Formatter

  1. Paste your SQL.
  2. Choose whether keywords should be in capitals.
  3. Copy the formatted query.

Questions

Which dialects work?

The common clauses of MySQL, PostgreSQL, SQLite and SQL Server all format fine. It lays the query out; it does not parse or validate it.

Will it change my query?

Only the spacing and the case of keywords. Text inside quotes is never touched.

Can it handle a very long query?

Yes, though deeply nested subqueries come out flatter than a hand-written layout would be.

Outils associés