SQL Formatter
Paste a query — get a clean, readable formatted version. 9 dialects, keyword case control, in-browser.
- Runs in browser
- No signup
- No tracking
How to use SQL Formatter
Paste your SQL into the input pane.
Pick the dialect (PostgreSQL, MySQL, etc.).
Choose keyword case and indent width.
Click Format. Copy or download the result.
When to use it
Cleaning up an ORM-generated query before debugging.
Preparing migrations for code review.
Reading a one-line query from logs.
Standardizing team SQL style without an IDE plugin.
What it fixes
Default IDE formatters that don't know your dialect.
Online tools that strip dialect-specific syntax (RETURNING, MERGE, QUALIFY).
Pasting sensitive query logic into a server-side service.
About SQL Formatter
SQL formatting matters when queries grow past a screenful. Consistent indentation makes joins, CTEs, and window functions readable, and makes diffs reviewable.
This tool wraps the sql-formatter library. It parses each dialect's grammar and re-emits with proper indentation. Multi-thousand-line scripts format in milliseconds.
References: PostgreSQL SQL command reference · sql-formatter (GitHub)
Frequently asked
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, SQLite, MariaDB, BigQuery, Snowflake, Redshift, and T-SQL (MSSQL).
Is my SQL sent to a server?
No. The sql-formatter library runs in your browser. Queries never leave your device.
Will it preserve my comments?
The Format option preserves comments. The Minify option strips them.
Can I uppercase my keywords?
Yes. Choose UPPER, lower, or Preserve in the toolbar.