For Microsoft Kool-Aid Drinkers, Non-paid MS Evangelists written by a Senior Consultant, Passionate about Tech

Visual Studio 2013 Tips & Tricks: Indentation (Tabs and Spaces)

imageAs a coder, you probably have a number of personal formatting conventions that you wish everyone would conform to while coding, right?  Take for example, tab spacing, or indenting of braces.  Some people have tabs embedded, others use spacing, etc.  However, maybe you like your indentation to be the same across your entire application.

Let’s take a look at some settings for Visual Studio 2013 that will allow you to setup your tabs and indentation.


By default, indentation in Visual Studio 2013 for tabs and indent sizes is 4.  For tabs, it will, by default, replace your tab with 4 spaces.  However, you can change them by going into Tools | Options | Text Editor | C# | Tabs.   The default looks something like this:


You can also get to the Tabs settings quickly by typing in Tabs into Quick Launch like below and selecting Text Editor –> C# –> Tabs


Changing this setting doesn’t apply it to any existing code, only when you attempt to add new tabs.  However, you can force it to format a document by opening it up and hitting the keyboard shortcut, <CTRL><K><D>.  This will format the document.

There is also a way to indent other things in your code by changing the settings under Tools | Options | Text Editor | C# | Formatting | Indentation, such as block contents, open/close braces, case contents, case labels, and label indentation.


Well, I hope that helps all of you Visual Studio 2013 developers who have to have things lined up correctly (which includes me too!)  Come on back periodically for more tips and tricks for Visual Studio 2013.


No comments yet.

Leave a Reply

You must be logged in to post a comment.