Every "best SQL formatter" article ranks the same five tools based on affiliate deals. Here is what people on r/SQL, r/dataengineering, and r/database actually use and recommend — with honest trade-offs, not marketing copy.
| Tool | Reddit Verdict | Price | Best For |
|---|---|---|---|
| sqlfluff | Gold standard for teams | Free (open source, Python) | CI/CD pipelines, team SQL standards |
| pgFormatter | Best for PostgreSQL | Free (open source) | PostgreSQL-only shops |
| Browser SQL formatter | Fast, no setup | Free | Quick one-off formatting, external queries |
| VS Code + extension | Good for daily SQL dev | Free | Developers already in VS Code |
| DBeaver built-in | Decent, not great | Free (Community) | Already using DBeaver for DB work |
| DataGrip | Powerful but expensive | $229/year | JetBrains ecosystem, professional DBAs |
| Azure Data Studio | Improving | Free | SQL Server teams |
| SSMS + RedGate SQL Prompt | Best for SQL Server | $369/year (SQL Prompt) | SQL Server enterprise shops |
Consistently the top recommendation on r/dataengineering for teams. sqlfluff is not just a formatter — it is a linter that catches actual issues: inconsistent aliasing, unused CTEs, ambiguous column references. It runs in CI/CD pipelines, so badly formatted SQL fails the build before it reaches code review.
Reddit caveat: "Setup takes an afternoon. Worth it for teams. Overkill for solo work or one-off queries."
If your stack is PostgreSQL, r/PostgreSQL consistently points to pgFormatter. It handles PL/pgSQL, custom types, and PostgreSQL-specific syntax that generic formatters sometimes break. Available as CLI, library, or web tool.
Reddit caveat: "Only useful if you are all-in on PostgreSQL. Does not handle T-SQL or MySQL-specific syntax."
This comes up in every r/SQL formatting thread:
| Convention | Reddit Support | Argument |
|---|---|---|
| Uppercase keywords | ~70% support | Visual separation between keywords and identifiers — SELECT stands out from column names |
| Lowercase keywords | ~30% support | Syntax highlighting makes capitalization redundant, lowercase is faster to type |
| Spaces (2 or 4) | ~80% support | Most SQL style guides and formatters default to spaces |
| Tabs | ~20% support | Personal preference, less common in SQL than general programming |
| Leading commas | ~40% support | Easier to comment out columns, see diffs clearly in version control |
| Trailing commas | ~60% support | More natural to read, matches most formatter defaults |
| Your Situation | Best Tool | Why |
|---|---|---|
| Team with CI/CD pipeline | sqlfluff | Automated formatting enforcement in builds |
| PostgreSQL-only team | pgFormatter | Purpose-built for PostgreSQL syntax |
| Quick format from Slack/email | Browser SQL formatter | Zero setup, paste and format |
| Daily SQL in VS Code | VS Code + SQL Formatter extension | Format on save, no context switch |
| Already using DBeaver | DBeaver built-in | Already there, decent enough |
| SQL Server enterprise | SSMS + SQL Prompt ($369/yr) | Best T-SQL formatting available |
| JetBrains user | DataGrip ($229/yr) | Integrated into the IDE you already use |
| Learning SQL | Browser formatter | See how proper SQL formatting looks |
Reddit is pragmatic about SQL formatting. The consensus:
Format SQL in seconds — no setup, no account, no debate.
Open SQL Formatter