Is there a way to set TAB button to work as 4 spaces in Visual Studio 2010 instead of going to Edit->Advanced->Untabify Selected Lines?

share|improve this question
+1 since within the question there is the hint how to untabify already existent sources, the accepted answer applies only for new sources – Shmil The Cat Oct 7 '14 at 17:33
Would somebody mind editing the "2010" out of the question title? This is applicable to many visual studio versions, and the UI is still the same for this part of the IDE for VS 2010, 2013, and 2015. Also it might help to add something to the question that implies that the OP is looking to set the style of new sources; the trick for editing existing sources is cool though. – jrh Dec 29 '16 at 18:52
Also note that "Tabify" and "Untabify" for existing source code files does not work for tabs inserted in the middle of the line, i.e., <tab> int <tab> x; would be replaced with <spaces> int <tab> x;, not <spaces> int <spaces> x; – jrh Apr 29 at 19:35
I am using Visual Studio Community for Mac and instead of untabify, I did Edit>Format>Format Document. – Mahdi Sep 15 at 7:35
up vote 145 down vote accepted

You can edit this behavior in:

Tools->Options->Text Editor->All Languages->Tabs

Change Tab to use "Insert Spaces" instead of "Keep Tabs".

Note you can also specify this per language if you wish to have different behavior in a specific langauge.

share|improve this answer
Just to share that is still the same for Visual Studio 2013. – James Feb 24 '15 at 19:42
What about tab size and indent size? – Magallo Apr 21 '15 at 10:24
@Magallo it's in the same settings area – Reed Copsey Apr 24 '15 at 20:37
In mine what took me so long to find the setting was the fact that theres a checkbox that hides half the settings. be sure to check show all settings – Andrew Afternoon-Delight Hayde May 1 '15 at 14:42
Just to share that is still the same for Visual Studio 2015. – Marek Czaplicki Oct 26 '16 at 12:38

If you don't see the formatting option, you can do Tools->Import and Export settings to import the missing one.

share|improve this answer

This does this by default now I think, it inserts spaces instead of TAB because apparently it's backwards day today and Microsoft are going full force backwards lol.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.