Logics Guru

SQL Formatter

Beautify SQL queries with keyword-aware indenting, in your browser.

Runs entirely in your browser. Your data never leaves this device and is never sent to our servers.
Formatted SQL

A query that arrives as one long line is unreviewable. This formatter puts each major clause on its own line and indents the conditions beneath it, so the shape of the query — what it selects, what it joins, what it filters — becomes visible at a glance.

How to use it

  1. Paste the query.
  2. Choose whether keywords should be uppercased.
  3. Pick an indent width and copy the result.

Not working as you expect? Report a problem with this tool.

Frequently asked questions

Does it change what my query does?
No. It only adds whitespace and adjusts keyword casing. The query is semantically identical.
Which dialects are supported?
The common clauses shared by MySQL, PostgreSQL, SQL Server and SQLite. Dialect-specific syntax is passed through untouched rather than being reformatted incorrectly.