SQL Formatter
Beautify and indent SQL queries for many dialects.
Format SQL for the dialect you actually use
Apply dialect-aware indentation to long queries for review and debugging. This formats syntax but does not execute the query or prove database-level validity.
Waiting
status
0 B
input size
—
output size
Keyword rules and syntax differ between database engines; choose the closest target before formatting.
SQL query
0 charactersFormatted SQL
No output yetAbout the SQL Formatter
Well-formatted SQL is far easier to read, review and debug than a single long line of keywords and columns.
Paste a query, pick your database dialect, and this tool re-indents it with consistent capitalisation and line breaks.
It supports many dialects including MySQL, PostgreSQL, SQL Server, SQLite and BigQuery, and runs entirely in your browser.
Key features
- Beautify and indent SQL
- Ten selectable SQL dialects
- Consistent keyword formatting
- Copy and explicit .sql download
- Runs in your browser
How to use
- 1Pick your SQL dialect.
- 2Paste or load your query and run Format SQL.
- 3Review the formatted text; remember that formatting does not execute or semantically validate it.
- 4Copy or download the .sql result.
Examples
select id,name from users where active=1 order by nameIndented SQL with SELECT, FROM, WHERE and ORDER BY separatedChoose the matching SQL dialect for the most appropriate keyword rules.
Frequently asked questions
- Which SQL dialects are supported?
- Standard SQL plus MySQL, PostgreSQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake and Spark SQL.
- Does it run my query?
- No. It only formats the text of your query. It never connects to a database or executes anything.
- Does it validate the SQL?
- It focuses on formatting, not validation, so it tidies the query without checking whether it would run successfully.
Continue your workflow
Open a related tool to prepare your files or refine the finished result.
- Featured toolDeveloper ToolsJSON Formatter
Format, validate and minify JSON instantly.
Open tool - Featured toolDeveloper ToolsXML Formatter & Validator
Format messy XML and check that it is well-formed.
Open tool - Featured toolDeveloper ToolsYAML Formatter & Validator
Format and validate YAML, and catch syntax errors.
Open tool
