SQL Server (T-SQL) formatter

Paste T-SQL, such as a query from SQL Server Management Studio, a stored procedure or a script with several batches, and make it readable: clauses on their own lines, consistent indentation and keywords in the case you choose.

T-SQL syntax understood

  • [Bracketed] names such as [dbo].[Orders], @variables and DECLARE
  • SELECT TOP, common table expressions (WITH … AS) and window functions
  • MERGE … WHEN MATCHED / WHEN NOT MATCHED, and CROSS APPLY
  • GO batch separators, kept on their own lines

Scripts with several batches

A script from Management Studio or Azure Data Studio keeps its GO lines where they are, and the statements of each batch are laid out one by one.

Stored procedures

Paste a procedure, a trigger or a function: DECLARE, SET and every statement inside BEGIN … END get lines of their own, so a long procedure becomes readable.

Queries your app runs

Paste the SQL that Entity Framework or Dapper logged, parameters such as @p0 included, to read what it really runs against the database.

Private: nothing is uploaded

Formatting, checking and comparing all happen in your browser. Your documents are saved in the browser's own storage on this computer, not on a server, so they never leave your device.

With your permission, we count anonymous visits (which pages and tools are used), never what you type. See Privacy.

Questions

Does it work for Azure SQL and Synapse?

Yes. They use T-SQL, which is what the SQL Server (T-SQL) dialect formats.

Will formatting change what my script does?

No. Only spaces and line breaks change, and the case of keywords if you choose. GO lines, bracketed names and strings stay exactly as written.

Is my data uploaded anywhere?

Your documents aren't: everything runs in your browser, and they are saved on your computer, in the browser's storage for this site. With your permission we count anonymous visits, never their content.

More tools