SQL Formatter

Pretty-print SQL queries. Supports MySQL, PostgreSQL, SQLite, MS SQL, BigQuery, and more.

SQL Input
Output

About SQL Formatter

Pretty-print long single-line SQL into clean, indented, multi-line form. Great for code review, debugging, and documentation.

Supported Dialects

Standard SQL, MySQL, PostgreSQL, SQLite, MS SQL (T-SQL), BigQuery and more - keywords and functions of each dialect are recognized correctly.

Privacy

All processing happens in your browser. You can safely format production-DB queries and sensitive SQL.

Dialect-specific differences to watch out for

SQL anti-patterns - five you see all the time

Official references

When your queries return JSON columns, use the JSON Formatter & Converter to inspect the output. For HTML, CSS, or JS code formatting, see the HTMLㆍCSSㆍJS Formatter.

FAQ

Does it format stored procedures and triggers?

Basic DDL/DML and some procedural SQL are supported. Very complex PL/SQL or T-SQL blocks may have edge cases.

Is the output executable?

Yes. Formatting only changes visual layout - the SQL semantics are preserved.

Which SQL dialects are supported?

Besides standard SQL, major dialects are recognized: MySQL, PostgreSQL, Oracle PL/SQL, SQL Server T-SQL, and BigQuery. Dialect-specific functions may be parsed as generic identifiers.