SQL Formatter & Beautifier Online
- This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.
SQL
Formatted SQL
Result appears here.About this tool
Long one-line queries copied from logs or ORMs are hard to read. Paste them here to get each clause — SELECT, FROM, JOIN, WHERE, GROUP BY — on its own line with nested conditions indented.
Pick your database dialect so vendor-specific syntax is understood, and choose whether keywords should be uppercase, lowercase or left as written. You can also pick 2 or 4 spaces of indentation. The Sample button loads a join with grouping so you can see the layout.
For example, select id,name from users where active=1 order by name becomes SELECT on one line, the columns beneath it, then FROM, WHERE and ORDER BY each starting a new line. Copy the result or download it as query.sql.
The dialect matters more than people expect. Quoting rules (backticks in MySQL, square brackets in SQL Server, double quotes in PostgreSQL), parameter placeholders and functions differ between databases, and a query written for one can fail to parse under another. If you see an error, switch the dialect before assuming the query is wrong. Standard SQL is the default and works for plain SELECT, INSERT, UPDATE and DELETE.
Queries are formatted locally, so it’s safe to paste ones that include table names or literal values from production.
Frequently asked questions
Which databases are supported?
Standard SQL plus MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), Oracle PL/SQL, SQLite, BigQuery, Snowflake, Redshift, Spark, DuckDB and Trino/Presto.
Does formatting change what the query does?
No. Only whitespace and keyword case change. String literals and identifiers keep their case, and the “Keep case” option leaves keywords as you typed them.
Why do I get a parse error?
The query may use syntax from a different dialect, or be incomplete, for example with an unbalanced bracket or quote. Try selecting the database you wrote it for. The first line of the message is shown.
Can it format several statements at once?
Yes. Statements separated by semicolons are each formatted and kept in order.
Does it check that my tables and columns exist?
No. It only reads the structure of the text. It does not connect to any database and cannot validate names or run the query.
Will it format stored procedures?
Procedural code such as T-SQL batches or PL/SQL blocks is handled in the matching dialect, but unusual vendor extensions can still fail to parse.