For dbt projects, sqlfmt or SQLFluff. In SSMS or Visual Studio, Redgate SQL Prompt or dbForge SQL Complete; for PostgreSQL, pgFormatter. Developers formatting SQL inside code can use the sql-formatter JavaScript library or sqlparse for Python, and Poor SQL handles one-off T-SQL in the browser.
Where these ten formatters come from
Nothing on this page comes from running these formatters on my own queries. I read each vendor's own homepage, README or product page in December 2026 and kept only the details those pages state. Two tools I'd planned to include had pages that wouldn't load, so they're not here. No one paid for a place, and where a page didn't cover a point, the table below says Not published.
The ten SQL formatters
SQLFluff
SQLFluff is an open-source, dialect-flexible SQL linter that auto-fixes linting errors and works with Jinja templating and dbt. You install it with pip and run it from the command line. Skip it if you want to paste one query into a web page.
Redgate SQL Prompt
Redgate SQL Prompt is a code completion and formatting add-in for SQL Server Management Studio and Visual Studio, with a free trial download, and it's also bundled in SQL Toolbelt Essentials. Skip it if you write SQL in neither of those two hosts.
dbForge SQL Complete
Devart's dbForge SQL Complete adds an integrated SQL Formatter to SSMS and Visual Studio, and its Professional edition brings T-SQL refactoring and debugging. A free trial is offered. Skip it if you want a free edition, since none of its editions shown is free.
Poor SQL
Poor SQL formats T-SQL free in the browser, works offline, and sits on an AGPL-licensed C# and JS library with plugins for SSMS, Visual Studio and WinMerge. The release shown dates from April 2019. Skip it if you write PostgreSQL, MySQL or Oracle.
sqlfmt
Built for dbt SQL files, sqlfmt installs on any device running Python with no configuration and keeps a cache while formatting hundreds of files per second. Its browser demo keeps queries on your device. Skip it if your SQL lives outside dbt projects.
pgFormatter
pgFormatter is a PostgreSQL SQL beautifier that runs as a console program or as a CGI web page, with options such as a wrap limit and vertical alignment. It's free under the PostgreSQL Licence. Skip it if you'd rather not install Perl.
SQL Formatter (sql-formatter-org)
This MIT-licensed JavaScript library lists dialects from BigQuery and DuckDB to Snowflake and Trino, and ships VSCode and Vim extensions plus a Prettier plugin. Its README admits the style options are very limited. Skip it if you need heavy style tuning.
DBeaver
DBeaver Community is a free, open-source database management tool with a SQL Editor, covering MySQL, MariaDB, PostgreSQL, SQLite and more, while DBeaver PRO adds advanced security. Skip it if a formatter is all you want, since this is a full database tool.
DataGrip
JetBrains' DataGrip runs on Windows, macOS and Linux and offers quick-fixes that work across multiple SQL dialects. It's free for non-commercial use, with a 30-day trial before a subscription. Skip it if your employer won't pay for a commercial subscription.
sqlparse
sqlparse is a non-validating SQL parser module for Python under the BSD-3-Clause licence, with a format() function offering reindent, keyword case, comment stripping and indent width. Skip it if nobody on your team writes Python.
Pros and cons of each type of SQL formatter
The ten split into five types. The type matters more than the brand, because it decides where formatting happens and who has to remember to run it.
Paste-in web pages. Upside: nothing to install, so they're quick for a single query or a colleague who doesn't live in SQL. Downside: someone has to remember to use them, and you're trusting a web page with your query. Look for a page that says it runs in the browser or offline, and check the last release date shown.
Editor add-ins for SSMS and Visual Studio. Upside: formatting lives where SQL Server developers already type, next to completion and refactoring. Downside: they're tied to those two hosts, and the two commercial add-ins here sell paid licences. Fine for a Microsoft shop, wasted on a team in VS Code.
Command-line formatters and linters. Upside: they run the same way on every laptop and in CI, so a pull request can fail on badly formatted SQL. Downside: someone has to install a runtime (Python or Perl here) and agree a config. A linter also flags rule breaks, not just layout, which is more than some teams want.
Libraries. Upside: you can format SQL inside your own app, script or editor plugin. Downside: you're writing code to use them, and option sets vary. One README here says plainly that its options are very limited.
Want AI doing the heavy lifting in your marketing?
I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.
Full database IDEs. Upside: formatting comes with the editor you query in, plus everything else. Downside: you're adopting a database tool to get a formatter, and licence terms for work use need checking.
Do you make a SQL formatter or SQL linter? Tool makers can ask to be considered for a featured place on this list.
Licence, form and dialects side by side
Each cell matches a line on the tool's own page. Not published means the page I read didn't say.
| Tool | Form | Licence or terms, as stated | Dialect or SQL named |
|---|---|---|---|
| SQLFluff | Command line (pip install) | Open source | Dialect-flexible; Jinja and dbt |
| Redgate SQL Prompt | SSMS and Visual Studio add-in | Subscription; free trial | SQL Server Management Studio |
| dbForge SQL Complete | SSMS and Visual Studio add-in | Paid per year; free trial | T-SQL refactoring (Professional) |
| Poor SQL | Web page, library, SSMS and WinMerge plugins | Free, open source, AGPL library | T-SQL |
| sqlfmt | Python install; browser demo | Not published | dbt SQL |
| pgFormatter | Console program or CGI | PostgreSQL Licence | PostgreSQL |
| SQL Formatter (sql-formatter-org) | JavaScript library; VSCode, Vim, Prettier | MIT | BigQuery, DuckDB, Snowflake, Trino and more |
| DBeaver | Database tool with SQL Editor | Community free and open source; PRO commercial | MySQL, MariaDB, PostgreSQL, SQLite and more |
| DataGrip | Windows, macOS and Linux | Free for non-commercial use; 30-day trial | Multiple SQL dialects |
| sqlparse | Python module and command line | BSD-3-Clause | Non-validating SQL parser |
Matching a formatter to how your team works
- Microsoft SQL Server shop: an SSMS add-in, so formatting sits beside completion. Check which of your developers use SSMS and which use something else first.
- Analytics engineers on dbt: a dbt-aware formatter or linter in CI, so every model looks the same before review. Pick one and remove the debate from pull requests.
- PostgreSQL team: a formatter that names PostgreSQL, run on save or in CI.
- Developers generating SQL in code: a library in your app's language, JavaScript or Python here.
- Occasional SQL writers: a web page or the formatter built into the database tool you already use.
Whichever row you're in, decide three settings before anyone formats a file: keyword case, indent width and maximum line length. Those three cause the arguments in code review, so check your shortlist exposes them. A tool that enforces a single style settles the argument by removing the choice, which some teams welcome and others resent. If your team has strong views, pick a configurable tool; if it has none, an opinionated one saves a meeting.
Then decide when formatting runs. On save in the editor is the gentlest option, a pre-commit hook catches anything missed, and a CI check is the only one that can't be skipped. I'd use at least two of the three, so a missed local run gets caught before review.
If you're still choosing the database client itself, my guide to database management tools covers that layer, and formatting JSON next to your SQL is a separate job I've covered in JSON formatter extensions.
Mistakes that undo a formatting standard
Two formatters fighting. If one developer formats in an editor add-in and CI runs a different tool, every commit flips the layout back and forth. Pick one source of truth and run the same config locally and in CI.
The wrong dialect. A T-SQL formatter can mangle PostgreSQL or Snowflake syntax it doesn't know. Run a sample of your oddest queries, with window functions, CTEs and vendor extensions, before rolling anything out.
Reformatting a whole repository in one commit without warning. It buries real changes in blame history. Do it in a single, clearly labelled commit and tell the team before open branches hit conflicts.
Licence surprises. Non-commercial terms and AGPL both matter if you ship or sell software. Read the licence line on the project page, not a blog summary.
Want your tool on this list? Featured spots and reviews here are paid partnerships. Here's how to partner with me.
Frequently asked questions
Is there a free SQL formatter for SSMS?
Yes. One free, open-source formatter on this list offers an SSMS and Visual Studio plugin alongside its web page. The two commercial SSMS add-ins here offer free trials rather than free editions.
What's the difference between a SQL formatter and a SQL linter?
A formatter changes layout: indentation, line breaks and keyword case. A linter also checks rules and flags problems; SQLFluff is a linter that can auto-fix many of the errors it finds.
Can I format SQL without sending it to a website?
Yes. Command-line tools and libraries run on your machine, and two of the browser options on this list say they work offline or keep your query on your device.


