SQL Formatter
Paste a query to lay it out clause by clause, with keywords in upper or lower case. Choose the SQL dialect so its own syntax, such as [brackets] or $1 parameters, is understood.
INPUT
OUTPUT
Runs entirely in your browser. Nothing you enter is sent to a server.
How to format SQL
Paste the query
Paste one or more statements from a log, an ORM or a colleague's message, or open a .sql file.
Pick the dialect and style
Choose the database, keyword case and indentation. The result updates as you type.
Copy or download
Copy the formatted SQL or download it as a .sql file.
Queries you can read at a glance
Generated and copied SQL often arrives as one long line. With each clause on its own line and conditions indented, it's easier to see which tables are joined, what is filtered and where a bracket is missing.
Dialects
Standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), SQLite and Oracle PL/SQL are supported. The dialect decides how quoted names, parameters and operators are read. Formatting uses the open-source sql-formatter library.
Frequently asked questions
Does it check that my query is correct?
No. It only changes the layout. If the formatter can't follow the query, for example because of an unclosed quote, it shows the line and column where it stopped. It doesn't connect to a database.
Are comments and string values kept?
Yes. Comments stay in place and text inside quotes is never changed, including its case.
Is my SQL sent anywhere?
No. Formatting happens in your browser, so queries with table names or customer data stay on your device.