QiLing Tools

🗃️SQL Formatter Online - Beautify & Minify SQL Queries

SQL copied from logs, ORM debug output or chat messages is often squeezed into one line and hard to read. Paste it here to get neatly formatted SQL: SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT, UNION, INSERT, VALUES, UPDATE, SET and DELETE each start a new line, column lists go one per line, AND / OR conditions break and align, JOINs are indented, and subqueries and CASE expressions are indented by depth. The tokenizer understands strings, comments, double-quoted / backtick / bracket identifiers and PostgreSQL dollar-quoted strings, so their contents are never altered. Keywords can be upper-cased, lower-cased or kept, with 2 / 4 space or tab indentation, and you can minify to a single line with comments removed. Multiple statements are supported.

Free · No sign-up · Runs in your browserLast updated:

Loading tool...

How to use SQL Formatter

  1. 1Paste SQL, including multiple statements and comments
  2. 2Choose Format or Minify and set keyword case and indentation
  3. 3Copy the formatted SQL on the right

FAQ

Can formatting change what my query does?
No. Only whitespace, line breaks and keyword case change; strings, identifiers and comments are left as-is. Minify mode removes comments, which does not affect execution.
Which SQL dialects are supported?
It uses generic SQL rules that fit MySQL, PostgreSQL, SQL Server, SQLite and Oracle, recognizing backtick and bracket identifiers, :: casts, ->> JSON operators and $1 / ? / :name placeholders. Complex DDL such as stored procedures may get only basic layout.
Why did a column name become upper-case?
Column names that are also SQL keywords (date, text, rank …) are treated as keywords when changing case. Choose Keep to leave casing alone, or quote such identifiers.
Is my data uploaded?
No. Everything runs locally in your browser with no network upload and is discarded when you close the page, so it is safe for internal or sensitive data.