SQL Formatter

Format SQL with consistent indentation and keyword case, for eight dialects.

Options
Formatted

Examples

Questions

Which SQL dialects are supported?

Standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, SQL Server (T-SQL), BigQuery and Snowflake. Pick one from the menu. They quote names and strings differently, so the right one matters.

Does it change strings or comments?

No. The formatter reads each dialect's syntax, so text inside quotes and comments stays as it is, even the word SELECT.

What if I paste invalid SQL?

An unclosed quote or similar gives an error with its line and column. SQL that reads as tokens but doesn't make sense is still formatted as well as possible.

Does formatting change what my query does?

No. Only whitespace, line breaks and keyword casing change. Every value, name and operator stays exactly as it was.