SQL Formatter
Beautify Queries
Format SQL queries for Standard SQL, MySQL, PostgreSQL, SQLite, BigQuery, MariaDB, PL/SQL, and T-SQL.
What is this tool?
This SQL formatter beautifies queries for Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, BigQuery, PL/SQL, and T-SQL. It restructures whitespace, line breaks, indentation, and keyword casing to make queries easier to read.
Formatting does not replace database validation. Dialects differ in functions, quoting, operators, procedural blocks, and vendor-specific syntax, so formatted output should still be reviewed before execution.
Use it to inspect generated ORM queries, clean up copied logs, prepare reviewable SQL in pull requests, and make complex joins or filters easier to reason about.
How to use
- Paste a SQL query into the input area.
- Select the SQL dialect that best matches your database.
- Choose the indentation width.
- Click Format, review the result, and copy the formatted query.
Examples
| Input / setting | Output | Notes |
|---|---|---|
select id, name from users where active = 1 order by created_at desc | SELECT\n id,\n name\nFROM\n users\nWHERE\n active = 1\nORDER BY\n created_at DESC | Standard SQL formatting with uppercase keywords. |
select count(*) from orders group by status | SELECT\n count(*)\nFROM\n orders\nGROUP BY\n status | Aggregation query split across clauses. |
Related tools & concepts
Last reviewed: 2026-05-08