About the SQL Formatter
Long SQL queries written on one line, generated by ORMs or copied from logs are hard to read and debug. The SQL Formatter restructures them with each clause (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY) on its own line, indented columns and conditions, and consistently cased keywords.
It supports the syntax of popular databases, including MySQL, PostgreSQL, SQL Server (T-SQL), SQLite, Oracle PL/SQL, MariaDB and BigQuery, powered by the open-source sql-formatter library running in your browser. Your queries, which may contain table names or data, are never sent anywhere.
How to use the SQL Formatter
- Paste your SQL query.
- Choose your database dialect and keyword case.
- Review the formatted SQL.
- Copy it or download it as a .sql file.
Frequently asked questions
Does it check if my SQL is correct?
It parses the query to format it and reports syntax it cannot understand, but it does not run the query or check table names.
Can it format multiple statements?
Yes. Separate statements with semicolons and they will all be formatted.
