DataFmt

SQL Formatter

Beautify SQL across dialects to make long queries easier to review and share.

Drag & drop a file here, or click to upload
Options:

About this tool

Long concatenated SQL strings and single-line ORM logs are a pain to read and debug. Hand-indenting them is tedious and error-prone.

Powered by the widely-used sql-formatter library, DataFmt handles standard SQL, MySQL, PostgreSQL, SQLite, BigQuery and more. Tune keyword casing and indent width to match your team's style.

How to use

  1. Paste SQL into the input panel.
  2. Pick a dialect and keyword case (UPPER / lower / Preserve).
  3. Choose indent width (typically 2 or 4 spaces).
  4. Click "Format".

Use cases

Notes

Frequently Asked Questions

Does formatting change query semantics?
No. Only whitespace, indentation and keyword casing are modified; the parse tree is untouched.
Which dialects are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, BigQuery, Db2, N1QL, PL/SQL, Redshift, Snowflake, Spark, TSQL, Trino and more.
Why are some function names not uppercased?
Only reserved keywords follow the casing policy. Function names are left as-is so that case-sensitive identifiers are not broken.