About SQL Formatter
Paste a SQL query and this tool lays it out in a clear, indented format with the keywords in capitals, so that long SELECT statements, joins and subqueries are easy to read and review. Choose the SQL dialect first (standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server or Oracle PL/SQL), because each has its own keywords and syntax.
The tool only changes layout. It does not run your query, connect to a database or check that the SQL is correct, so a query with a mistake may still be formatted. If the formatting library cannot be loaded, the tool falls back to a very basic layout that starts new lines at the main keywords.
The formatting is done in your browser, so your queries are not sent to our server. Even so, remove real passwords, customer data and secrets from queries before you share the formatted result.
Who uses it and when
Code reviews
Make a long query readable before you review it.
Debugging
Spot the join or condition that is wrong.
Documentation
Paste tidy SQL into docs and tickets.
Logs
Reformat a one-line query copied from a log.
Why use this SQL Formatter
Readable SQL for the dialect you use.
Six dialects
Standard SQL, MySQL, MariaDB, PostgreSQL, T-SQL and PL/SQL.
Clean indentation
Keywords in capitals and nested clauses indented.
Browser-only
Your SQL is not uploaded.
How it works
Paste your SQL
Or click Sample to try it.
Choose the dialect
Pick the database you use.
Click Format and copy
Copy the formatted query.
Frequently asked questions
Does it run my query?
No. It only formats the text.
Does it check that my SQL is valid?
No. It formats what it can read but is not a validator.
Why choose a dialect?
Each database has its own keywords and syntax, and the right choice gives better formatting.
Is my query uploaded?
No. It is formatted in your browser.