Format SQL Query Online

Format SQL queries online with uppercase keywords and clean indentation. Paste a one-line query and get readable SQL instantly. Free and private.

Part of the free SQL Formatter. Runs in your browser — nothing is uploaded.

Format SQL Query Online

SQL pasted from logs or ORMs usually arrives as a single long line. This formatter breaks it into clauses, indents joins and conditions, and uppercases keywords so the logic of the query is obvious in seconds.

Worked example: One-line query to readable SQL

Input

select u.id, u.name, count(o.id) as orders from users u left join orders o on o.user_id = u.id where u.created_at >= '2026-01-01' and u.status = 'active' group by u.id, u.name having count(o.id) > 5 order by orders desc limit 10;

Formatted SQL

SELECT
  u.id,
  u.name,
  count(o.id) AS orders
FROM
  users u
  LEFT JOIN orders o ON o.user_id = u.id
WHERE
  u.created_at >= '2026-01-01'
  AND u.status = 'active'
GROUP BY
  u.id,
  u.name
HAVING
  count(o.id) > 5
ORDER BY
  orders DESC
LIMIT
  10;

Practical tip

Format before you review. Reading each clause on its own line makes missing join conditions and wrong GROUP BY columns much easier to spot.

How to use this SQL Formatter

  1. 1Use the live tool above — it runs entirely in your browser and never uploads your data.
  2. 2Paste the sample from the worked example, or use your own input.
  3. 3Copy the result, then adapt the same steps in your editor, script, or pipeline.

Format SQL Query Online FAQs

Does the formatter change what my query does?

No. It only changes whitespace and keyword casing. String literals, identifiers and logic are left alone.

Is my SQL sent to a server?

No. Formatting runs in your browser, so table names and business logic in your queries stay private.

More SQL Formatter pages

Open the full SQL Formatter tool →