About SQL Formatter

Formats SQL with a real dialect-aware tokenizer rather than blind find-and-replace, so string literals, quoted identifiers, and comments are never mangled. Choose from 17 dialects — Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Snowflake, Redshift, Spark, DuckDB, Trino/Presto, Hive, DB2, ClickHouse, and Couchbase N1QL — each with its own keyword set and quoting rules. Configure keyword casing, indent width, and whether logical operators (AND/OR) start or end the line. Formatting runs live and entirely in your browser; upload .sql/.txt files and copy or download the result.

  • Dialect-aware parser (sql-formatter) understands per-engine keywords, functions, and quoting
  • String literals, quoted identifiers, and comments are preserved verbatim — never recased or line-broken
  • 17 dialects including PostgreSQL, MySQL/MariaDB, T-SQL, PL/SQL, BigQuery, Snowflake, Redshift, Spark, DuckDB, Trino
  • Keyword case (UPPER/lower/preserve), indent size (2/4/8), and AND/OR newline placement
  • Live re-formatting on every change; upload .sql/.txt and download the result

Frequently Asked Questions

Does this handle stored procedures or PL/SQL blocks?
Yes for the most part — the parser supports procedural constructs (BEGIN/END, IF, LOOP, DECLARE) in dialects like PL/SQL and T-SQL. Pick the matching dialect for the best nesting. Extremely vendor-specific syntax may still be left as-is.
Will formatting change my query’s behavior?
No. Only whitespace and keyword casing change. Identifiers, string values, and the logical structure of your query are preserved exactly.

More Development Tools

All Development tools