336

I don't know what I did but I don't know how to get rid of those arrows on the left.

alt text

3
  • 7
    Well maybe it should say something about arrows because I didn't know what they were and people who want to get rid of them probably doesn't either (I don't think i'd Google "How to get rid of whitespace characters" unless I know they are whitespace characters and most likely already know how to get rid of them)
    – Juan
    Commented Nov 2, 2010 at 15:49
  • 7
    Actually, this just happened to me and I knew exactly what they were, but didn't know how to hide them, so I searched Google for "Visual Studio Hide Whitespace Characters" and this was the first result. So, thanks!
    – bubbleking
    Commented Jun 8, 2016 at 14:53
  • Unfortunately neither the keyboard shortcut(s) nor menu placement is intuitive. As a result I have googled this exact stack overflow post (via visual studio show whitespace dozens of times over the years when installing VS on a new machine at a new job. Summary: No, just knowing they are whitespace characters doesn't mean you know how to toggle them. Commented May 24, 2017 at 0:36

6 Answers 6

660

CTRL+R, CTRL+W : Toggle showing whitespace

or under the Edit Menu:

  • Edit -> Advanced -> View White Space

[BTW, it also appears you are using Tabs. It's common practice to have the IDE turn Tabs into spaces (often 4), via Options.]

20
  • 2
    hehe I toggled it on again by mistake XDDD Thank you!!! Anybody knows why this feature even exists? Isn't it infinitely annoying?
    – Vintharas
    Commented Dec 13, 2011 at 10:48
  • 35
    @Vintharas: It exists because people like me keep it on ALL THE TIME, because we like always being aware of what we're inserting or how we're changing the file. Gives us more casual control over our environment. There are also cases where it's actually critical, such as inside strings that are getting parsed.
    – Thought
    Commented Jul 6, 2014 at 23:30
  • 3
    I find it useful because our coding standards prohibit any trailing whitespace so this allows me to see any. I am not able to install add ons to fix it for me as we use the Express version.
    – Stefan
    Commented Aug 28, 2014 at 7:43
  • 3
    nvm. you use tabs. I'll use spaces. Commented Apr 1, 2015 at 5:32
  • 10
    @MitchWheat Seems to me that most developer disagree with you. I suggest you read their comments. It might change your minds about using tabs programmers.stackexchange.com/questions/57/…
    – JSON
    Commented Aug 3, 2016 at 13:25
46

In Visual Studio 2010 the key sequence CTRL+E, S will also toggle display of whitespace characters.

5
  • I can confirm that this also works in Visual Studio 2013 Express.
    – jmstoker
    Commented Jun 2, 2014 at 21:00
  • 1
    Ah that's interesting. I couldn't work out in what universe I could possibly have pressed CTRL-R, CTRL-W by mistake; but CTRL-E, S seems a bit more plausible. Commented Oct 7, 2014 at 8:39
  • That must have been what I hit on accident when going to toggle some comments (CTRL-E, C, CTRL-E, U)
    – jocull
    Commented Oct 30, 2014 at 15:21
  • 2
    Or accidentally hitting E when trying to save with CTRL-S
    – DrDeth
    Commented Nov 4, 2014 at 12:27
  • There are different default keyboard mappings available. CTRL-E, S is the sequence in one of them. CTRL-R, W is the sequence in another. Giving any individual sequence, though, is futile because they are all changed by a different setting, and can in any case be overridden.
    – ClickRick
    Commented Oct 28, 2022 at 14:09
11

If the Toggle Visual Space icon shall be added to a Visual Studio toolbar of your choice, because it shall be turned on and off via mouse click, then follow this instruction:

  1. Customize the desired toolbar

  2. Click on Customize...

  3. Click on Add Command...

  4. Go to Edit and chose Toggle Visual Space

  5. Click on OK

Tested with Visual Studio 2019 as well as Visual Studio 2022.

2
  • 2
    That's what I was looking for - the wording that's used in that dialog, so I can add it to a toolbar rather than having to remember a key sequence!
    – ClickRick
    Commented Oct 28, 2022 at 14:11
  • 1
    interesting, how I was suppose to find the button in this "add command" window? There are no search by name, and in the Edit/Advanced it is called "view white space"
    – yalov
    Commented Jul 18, 2023 at 12:55
8

In Visual Studio 2015 From the top menu

Edit -> Advanced -> View White Space

or CTRL + E, S

1
  • 1
    There are different default keyboard mappings available. CTRL-E, S is the sequence in one of them. CTRL-R, W is the sequence in another. Giving any individual sequence, though, is futile because they are all changed by a different setting, and can in any case be overridden.
    – ClickRick
    Commented Oct 28, 2022 at 14:10
3

CTRL+SHIFT+* is the de-facto standard key combination for showing/hiding whitespace characters in all Microsoft products that support this feature.

P.S: * refers to 8- * key, not to numeric keypad * key.

2
  • Works in VS 2017 Commented Apr 15, 2019 at 18:55
  • Doesn't work in Visual Studio for all of the key mapping sets.
    – ClickRick
    Commented Oct 28, 2022 at 14:11
3

for VS code and later versions Ctrl + P to open and then writing Whitespace, you can select the View: Toggle Render Whitespace

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