SQL Formatter

SQL Formatter

Paste a query to uppercase its keywords and lay clauses out on their own lines.

The SQL Formatter turns a dense one-line query into a structured, readable statement: major keywords are uppercased, each main clause starts on its own line, joins are indented, and conditions line up under WHERE with AND and OR stepped in. Queries pasted from application logs or ORM output are notoriously hard to review; a consistent layout makes logic errors and missing conditions visible at a glance.

The formatter recognises the clauses working developers use daily, including SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT, the common JOIN family, INSERT, UPDATE, and DELETE, and it tidies comma-separated lists onto separate lines. Keyword matching is word-boundary aware, so a column named "order_date" is never mistaken for the ORDER keyword.

It is a formatter, not a validator: it will not connect to a database, check table names, or guarantee the query runs. What it guarantees is a cleaner view of exactly the query you pasted, produced locally in your browser with nothing uploaded.

How to use

  1. Paste your SQL query into the box.
  2. Click Format SQL.
  3. Review the structured result below.
  4. Copy it back into your editor, console, or ticket.

Frequently asked questions

Does it format subqueries and joins?

Yes. Joins are stepped in from the main clause and conditions under WHERE are indented, so nested logic reads in the order the database thinks about it.

Which SQL dialects are supported?

The formatter targets standard SQL shared by MySQL, PostgreSQL, SQLite, and SQL Server for everyday SELECT, INSERT, UPDATE, and DELETE statements. Vendor-specific syntax is formatted on a best-effort basis.

Does it change my query's meaning?

No. It changes keyword case, line breaks, and spacing only. Identifiers keep their original case so case-sensitive databases are unaffected.

Can it check whether my query is correct?

No. Formatting is not validation. Run the query in your database tool to check syntax and results; this tool's job is to make the query easy to read first.

Is my query uploaded?

Never. Formatting happens in your browser only.