Back to home

SQL Formatter

Pretty-print SQL for your dialect, or strip comments and whitespace

Dialect
Action
Keywords
Indent
SQL
SQL
SELECT
  u.id,
  u.name,
  count(o.id) AS orders,
  sum(o.total) AS spent
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) > 3
ORDER BY
  spent DESC
LIMIT
  20;

Minify strips comments and collapses whitespace while leaving string literals untouched; formatting uses sql-formatter, whose keyword sets vary per dialect.