SQL Formatter

Format SQL with keywords in capitals and one major clause per line.

Runs in your browser. Nothing is uploaded — your input is processed on this device and discarded when you close the tab.

SQL Formatter

How to use this tool

  1. Paste your SQL into the box.
  2. Press Format to upper-case keywords and put major clauses on their own lines.
  3. Copy the result with Copy result and paste it back into your editor.

Worked example

Format the sample: select id, name from users where age > 18 order by name becomes SELECT id, name, then FROM users, WHERE age > 18 and ORDER BY name each on its own line.

What this tool does not do / Limits

This is a readability formatter, not a SQL parser: it does not validate SQL, does not understand every dialect, and can misplace keywords inside string literals. Always check the formatted query still runs before using it.

Frequently asked questions

Does it change what the query does?

No — it only changes whitespace and keyword case. It never renames tables or columns or reorders clauses.

Can it format very long queries?

Yes, for typical pasted queries. Extremely long pastes (hundreds of thousands of characters) may be slow; split them if the page lags.

Related tools