Code · SQL

SQL Formatter

Pretty-print SQL for any major dialect with consistent keyword casing and indentation.

SQL
Formatted
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.active = TRUE
GROUP BY
  u.id,
  u.name
ORDER BY
  orders DESC
LIMIT
  10;

Frequently asked

Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite and BigQuery, among others.

No. This tool runs entirely as JavaScript in your browser — your input never leaves your device and nothing is logged.

How to use

1

Pick your dialect.

2

Paste your SQL.

3

Copy the formatted query.

Related tools