SQL Formatter

Format messy SQL into readable, indented queries - supporting SELECT, INSERT, UPDATE, DELETE, and more.

Developer Tools100% private

SQL Formatter

Format messy SQL into readable, indented queries - supporting SELECT, INSERT, UPDATE, DELETE, and more.

SELECT
  id,
  name,
  email
FROM
  users
WHERE
  age > 18
  AND active = 1
ORDER BY
  name DESC
LIMIT
  10;
13 lines

How it works

  1. 1
    Paste your SQLAny SELECT, INSERT, UPDATE, or DELETE query - even minified or single-line.
  2. 2
    It formats instantlyClauses are moved to new lines and indented. Parenthesized expressions get nested indentation.
  3. 3
    Copy the clean SQLGrab the formatted query for your editor or codebase.

Frequently asked questions

Which SQL dialects are supported?
The formatter handles MySQL, PostgreSQL, SQLite, SQL Server, and more - it auto-detects common dialects. Functions and type casts are preserved as-is.
Does it change my query's meaning?
No. Only whitespace and line breaks are added. Keywords are not reordered, so the output runs identically to the input.
Can it handle subqueries?
Yes. Nested parentheses and subqueries are tracked and indented correctly.

Related tools