All tools

SQL Formatter

Pretty-print messy SQL into readable form.

Indent
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 > '2024-01-01'
  AND u.active = true
GROUP BY u.id, u.name
ORDER BY orders desc
LIMIT 50;

About

Paste a SQL query and get it formatted with consistent indentation, uppercase keywords, and one clause per line. Works on SELECTs, JOINs, CTEs, and most common DDL. Runs entirely in your browser.

How to use

  1. Paste your SQL.
  2. Pick a tab size.
  3. Copy the formatted query.

FAQ

Does it understand all SQL dialects?+

It handles standard SQL, plus most Postgres and MySQL extensions. Vendor-specific syntax (T-SQL, PL/SQL) may format awkwardly.