SQL Formatter & Beautifier
Pretty-print SQL in your dialect with consistent keyword casing and indentation, or squeeze it onto one line. Queries are formatted locally and never uploaded.
Frequently Asked Questions
Is my SQL sent to a server?
No. Formatting runs in your browser using the open-source sql-formatter library, served from this site. Queries containing table names or data never leave your machine.
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, BigQuery, Snowflake, Redshift, SQL Server (T-SQL), Oracle PL/SQL, DB2, Hive, Spark, Trino/Presto, DuckDB, SingleStore, TiDB and Couchbase N1QL.
Should SQL keywords be uppercase?
It's a convention, not a requirement: SQL keywords are case-insensitive. Uppercase keywords make queries easier to scan, which is why it's the default here, but you can preserve or lowercase them.
Why did formatting fail?
The formatter parses your query for the selected dialect. Dialect-specific syntax (for example backtick identifiers outside MySQL/BigQuery, or :: casts outside PostgreSQL) can fail in another dialect; pick the matching dialect or Standard SQL.