Skip to content
toola.

SQL → pretty

SQL formatter

Paste a one-line or messy query and get it laid out with clauses on their own lines, consistent indentation and keywords in the case you prefer. Pick your database’s dialect so its own syntax is understood. Queries are formatted in your browser and never sent anywhere.

Private: your files never leave your device.

Indent
Keywords

How was this tool?

How to use SQL formatter

  1. Step 1: Paste your SQL.

  2. Step 2: Choose the dialect, indentation and keyword case.

  3. Step 3: Copy the formatted query or download it as a .sql file.

Before and after

select id, name from users where active = 1 and created_at > '2026-01-01' order by name

becomes one clause per line, with the column list and conditions indented:

SELECT id, name FROM users WHERE active = 1 AND created_at > '2026-01-01' ORDER BY name

Formatting uses the open-source sql-formatter library. Very unusual vendor syntax may not be recognised; if a query fails, try the closest dialect or Standard SQL.

Frequently asked questions

Does formatting change what the query does?

No. Only whitespace, line breaks and keyword case change; names, values and strings are kept exactly.

Why pick a dialect?

Databases differ in syntax: identifiers in `backticks` (MySQL) or [brackets] (SQL Server), :: casts (PostgreSQL), and so on. The right dialect avoids errors and odd line breaks.

Is it safe for production queries?

Yes. The formatter runs in your browser; table names and data in your queries stay on your device.