For SQL Server Management Studio 21 / 22

SSMS SQL Formatter

Format T-SQL directly inside SSMS — two engines, full style control, comment-safe reformatting, SELECT * expansion, and one-click export of results to styled Excel or CSV.

Download the latest release Read the User Guide Download User Guide (PDF)

Before

select * from dbo.Orders o
join dbo.Customers c on c.CustomerId = o.CustomerId
where o.OrderDate >= '2026-01-01' and o.Status = 'Open'
order by o.OrderDate

After — formatted, SELECT * expanded

SELECT   o.OrderId,
         o.CustomerId,
         o.OrderDate,
         o.Status,
         c.CustomerId,
         c.CustomerName,
         c.Email
FROM     dbo.Orders AS o
         INNER JOIN
         dbo.Customers AS c
         ON c.CustomerId = o.CustomerId
WHERE    o.OrderDate >= '2026-01-01'
         AND o.Status = 'Open'
ORDER BY o.OrderDate;

Free & MIT-licensed  •  No account, cloud sync, or internet connection required

What it does

A VSIX extension for SQL Server Management Studio 21/22 that formats the query window in place, automates that formatting as you work, and exports results — plus a standalone CLI for CI. Nothing you didn't ask for ever leaves your machine.

Two formatting engines

Rule-based (Microsoft ScriptDom) is fully offline and instant — used for save/paste/batch/CI. AI (your own Anthropic or Copilot key) preserves comments exactly and follows free-form style instructions.

Full control over style

Classic or Modern presets, or a fully Custom mix of keyword/function/type casing, indentation, comma placement, per-clause line breaks, multiline lists, alignment for JOINs/CASE/assignments, and blank-line/GO spacing.

Comments are never silently dropped

Choose Inline (reattached to the code they were next to), MoveToEnd (collected at the bottom), or Discard — with a warning before anything is dropped.

Expand SELECT *

Replaces SELECT * (and alias.*) with an explicit column list resolved from the real table/view structure via your active connection — including linked-server tables. Leaves it untouched wherever it can't confidently resolve the source.

Fits into your workflow

Format on save, format on paste, batch-format a folder of files, or format every open document at once — each a normal, undoable edit, never a network call. A dedicated toolbar puts the four most-used commands one click away.

Export results to Excel or CSV

One shortcut turns the results grid into a styled workbook — bold headers, frozen header row, AutoFilter, banded rows, and text-safe cells so IDs and leading zeros survive.

Built for CI

A standalone ssmssqlfmt CLI (no SSMS or AI required) gates a PR on "SQL is formatted," and a shared .sqlformatter.json keeps the IDE and CI using the exact same style.

Your settings, portable

Export or import your entire configuration as one JSON file — share a team style, back up before experimenting, or feed it straight into the CLI.

Want the full reference first?

Every option, shortcut, and setting is covered in the User Guide — read it online or keep a PDF copy on hand.

Ready to try it?

Get the free VSIX from Visual Studio Marketplace, or read the full user guide first.