SQL Formatter

Format SQL queries with proper indentation, line breaks after clauses, and configurable keyword casing.

Indent
Keywords
Load example:
SQL input
Formatted output
SELECT
  u . id,
  u . name,
  u . email,
  COUNT(o . id) AS order_count,
  SUM(o . total) AS total_spent
FROM
  users u left
JOIN
  orders o
ON
  u . id = o . user_id
WHERE
  u . active = TRUE
  AND u . created_at > '2024-01-01' group by u . id, u . name, u . email
HAVING
  COUNT(o . id) > 0 order by total_spent desc
LIMIT
  2 0