Learn more about SQL Server tools

mssqltips logo

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Scripts          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories


SQL Formatter Tool

By:   |   Updated: 2006-06-07   |   Comments (6)   |   Related: More > Tools


One of the things that drives me crazy is having to format my SQL statements. It is hard enough writing the statements in the first place, but then having to take the time to format the code, make keywords uppercase, using tabs to align column names, tables names etc... is just a lot of work. But it is one of those things that if you don't do it now it never happens except for the next time that you edit that code and spend a bunch of time formatting it anyway.


Well one option is to do the formatting as you write your SQL code. This makes the most sense, but often times you get code from other places or when you copy and paste the code everything is misaligned.

Here is a free online formatter tool that allows you to just paste in your SQL statements and it will format the statement automatically based on some of the options you select. Overall it is an extremely simple process, but a tool that you will use over and over again.

Here is the URL.  Also check out other options in the comments below.

Below is a simple screen reproduction of what the tool looks like.

Next Steps
  • Don't waste time formatting your code go check out this tool to see how helpful it really is
  • Whenever you write SQL code use this simple tool to reformat the code for you
  • Bookmark the above URL and add it to your toolbox

Last Updated: 2006-06-07

get scripts

next tip button

About the author
MSSQLTips author Greg Robidoux Greg Robidoux is the President of Edgewood Solutions and a co-founder of MSSQLTips.com.

View all my tips
Related Resources

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 

Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.


Friday, October 11, 2013 - 12:49:49 AM - Aravind Back To Top

This is one of the Online SQL Code Formatter that I use regularly,



Tuesday, May 21, 2013 - 5:57:29 AM - Marina Nastenko Back To Top

There is also a free on-line SQL-formatter from Devart http://www.sql-format.com/ which is powered by a more profound add-in for SSMS and VS - SQL Complete. It works just for SQL Server but it's a good one with lots of formatting options.

Tuesday, July 24, 2012 - 8:29:34 AM - Andrei Back To Top

These free add-ins also do the job:

http://www.ssmsboost.com/  (has also more additional features)

http://www.architectshack.com/PoorMansTSqlFormatter.ashx  (available as add-in and as online tool)

Tuesday, April 17, 2012 - 5:57:06 AM - ameyoko Back To Top


SQLConvert for Silverlight

Monday, April 02, 2012 - 9:37:09 AM - bertha Back To Top

and another at www.sql2string.com

it's very simple, free and useful.

Monday, February 27, 2012 - 5:50:59 PM - Guido Back To Top

There is another free online SQL Formatter at www.sqlinform.com

Learn more about SQL Server tools