TSqlFormatter
Format T-SQL scripts into clean, consistently styled output. Paste, pick a style, done - or run it headless from your build pipeline.
Key features
- Five formatting styles Classic, Comfortable and their lowercase Minimalist variants, plus Microsoft's lossless SQL Server parser output.
- Instant formatting The formatted pane updates as you type, and the result is copied to the clipboard automatically.
- Headless CLI mode Run
TSqlFormatter.exe <style> <input> <output>in scripts, with clear exit codes for CI/CD. - Your SQL is never lost The output is either correctly formatted SQL or your original SQL with an explanatory comment - never mangled. Constructs a style can't handle fall back to the SQL Server parser style.
- Preserves what matters Comments stay in place, GO batch separators are kept, and a custom batch-separator marker is supported.
- Broad T-SQL support DML, DDL, CTEs, window functions, MERGE, PIVOT, TRY...CATCH, cursors, transactions, FOR XML/JSON and more.
Example
The Classic style aligns clause bodies in a column:
SELECT EmployeeId,
Name,
Salary
FROM Employees
WHERE DepartmentId = 5
AND IsActive = 1
ORDER BY Salary DESC;
At a glance
- Platform
- Windows desktop application with command-line mode
- Price
- Free
- Download
- TSqlFormatter.zip (2.6 MB)
- Output
- UTF-8 without BOM
- Package
- TSqlFormatter.exe and README.md