SQLFormatter
FormatterConvertPricingDocsGet Pro
Formatter · T-SQL

Format T-SQL SQL online

Reformat T-SQL queries against T-SQL's own grammar: consistent indentation, aligned clauses and uppercase keywords. Paste one-line or ORM-generated SQL and get structured, reviewable output.

1Paste your T-SQL query into the editor.
2Press Format — or ⌘↵.
3Copy clean, highlighted SQL.
Open formatter
before
select top 20 OrderId,CustomerName,isnull(Total,0) as Total from dbo.Orders where Status='shipped' order by CreatedAt desc;
T-SQL
SELECT
  TOP 20 OrderId,
  CustomerName,
  isnull(Total, 0) AS Total
FROM
  dbo.Orders
WHERE
  Status = 'shipped'
ORDER BY
  CreatedAt DESC;

Why format T-SQL?

T-SQL (SQL Server) has its own dialect: TOP instead of LIMIT, [bracket]-quoted identifiers, ISNULL, and statement terminators SSMS is picky about. The formatter follows Transact-SQL rules so bracketed names and TOP clauses format correctly.

Especially useful for queries copied out of SSMS or Profiler traces that need to go back in clean.

All SQL formatters & beautifiers

Format PostgreSQLBeautify PostgreSQL
Format MySQLBeautify MySQL
Format T-SQLBeautify T-SQL
Format SQLiteBeautify SQLite
Format BigQueryBeautify BigQuery
Format OracleBeautify Oracle
Format SnowflakeBeautify Snowflake
Format RedshiftBeautify Redshift