Something wrong with this tool?
About SQL Beautifier Online
This tool formats SQL queries with consistent indentation, keyword capitalisation, and line breaks. Long SELECT statements with multiple joins become readable, with each clause (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) clearly separated.
SQL beautification is essential when reviewing complex queries, embedding SQL in documentation, debugging production queries from logs, or sharing queries with colleagues. Unformatted SQL on one line is technically valid but practically unreadable.
The tool understands modern SQL dialects (PostgreSQL, MySQL, SQL Server, Oracle, SQLite) and handles CTEs (WITH clauses), window functions, subqueries, and stored procedure bodies correctly.
How to use this tool
How to pretty-print a SQL statement
Paste the SQL
Drop a `SELECT`, `INSERT`, `UPDATE`, `DELETE`, or DDL statement into the "SQL" field. Most major dialects work — Postgres, MySQL, SQLite, MS SQL — though dialect-specific syntax (window-frame `ROWS BETWEEN`, `JSON_VALUE`, …) is kept verbatim, not normalised.
Press Run
Result returns a single `formatted` field. Keywords go uppercase (`SELECT`, `FROM`, `JOIN`, `WHERE`), columns indent under `SELECT`, joins land on their own line, and `AND` / `OR` chains break under `WHERE`.
Comments and strings
Single-line (`-- …`), block (`/* … */`), and Postgres `--` style comments pass through. String literals (`'foo'`) and quoted identifiers (`"col"`, `` `col` ``) are never touched — content inside them is treated as opaque.
What it doesn't change
No query rewriting, no optimisation hints, no schema validation. If your query reorders joins or alters parens, that's the formatter making cosmetic spacing choices — the semantics never shift.