Is there any way to make Visual Studio word-wrap at 80 characters? I'm using VS2008.
-
Is this a personal thing, or do you have an instructor for a class that requires it? I would find line wrapping at all rather... restrictive to my coding style, as I like to use long descriptive names for things. ^_^ – Blank Oct 25 '08 at 14:54
-
I'm with Nicholas Flynt - restricting code to 80 characters per line is typical for uni assignments, but is in my opinion rather unproductive in The Real World[TM]. – OregonGhost Oct 25 '08 at 17:21
-
5Maybe 80 is too restrictive... but I prefer a relatively narrow setting because it lets me see the whole statement at once, without auto-hiding the toolbox and other auxiliary windows. – JosephStyons Oct 29 '08 at 17:55
-
9Restrict column width has many advantages. Read this: http://www.cookcomputing.com/blog/archives/000545.html See this: http://vulcan.eager.googlepages.com/whereis.png – Agnel Kurian Dec 17 '08 at 07:48
-
I always allow word wrap for everything except Python, where it's confusing - precisely because I like to use long, descriptive names and want to see everything on the line, not just the first bit – thepeer Mar 11 '10 at 14:59
-
@thepeer In my opinion, if your names are long enough to force word-wrapping, they are probably too long to be easily readable, which actually makes your code *harder* to understand. (Though my experience is based on trying to read lots of code with long "descriptive" names bordering on the pathological--some method names were 80+ characters on their own.) – Kyle Strand Mar 29 '17 at 17:28
-
1@KyleStrand I'm with you. I find code a lot more understandable if I can view it on one screen. When I posted this 8 years ago, I was a little more dogmatic about wanting my 80 characters (because if its good enough for a console, its good enough for studio!). Now, I'm happy if i can just see everything at a reasonable font size. – JosephStyons Mar 29 '17 at 20:37
-
1I got here looking for a way to *hard* wrap a block comment. (I agree with others that auto-wrapping code is not likely to be that useful, though some amount of discipline in limiting line length in comments and code can help when diffing during code reviews, etc.) Not finding what I was looking for, I did find this rewrap tool: https://marketplace.visualstudio.com/items?itemName=stkb.rewrap Haven't tried it, but it looks like it would do the job. – Tom Bogle May 01 '20 at 14:50
-
.editorconfig files have a setting for this, but VS does not support it. You can upvote the request to add that support here: https://developercommunity.visualstudio.com/t/support-max-line-length-in-editorconfig-for-visual/567214 – kevinpo Apr 06 '23 at 17:45
10 Answers
Unless someone can recommend a free tool to do this, you can achieve this with ReSharper:
ReSharper >> Options... >> Languages/C# >> Line Breaks and Wrapping
- Check "Wrap long lines"
- Set "Right Margin (columns)" to the required value (default is 120)

- 20,030
- 7
- 43
- 238

- 31,174
- 15
- 92
- 157
-
31In R# 8.x it's under RESHARPER >> Options >> Code Editing >> C# >> Formatting Style >> Line Breaks and Wrapping – Vlad Bezden Mar 06 '14 at 22:33
-
1In Visual Studio 2019 (with ReSharper 2020.1) the path is now Extensions >> ReSharper >> Options >> Code Editing >> C# >> Formatting Style >> Line Breaks and Wrapping – Mike Grove aka Theophilus Jul 17 '20 at 18:51
Tools >> Options >> Text Editor >> All Languages >> General >> Select Word Wrap.
I dont know if you can select a specific number of columns?

- 3,903
- 8
- 35
- 46
-
5VS 2013: no option for the number of columns; However the wrap is adjusted if you change the size of the VS window. – Guilherme Salomé May 13 '15 at 19:22
-
13I do not think this is the wanted behavior, at least not what I want. Is there a way to set the width of a line ? – sop Jun 21 '18 at 08:11
I don't think you can make VS wrap at 80 columns (I'd find that terribly annoying) but you can insert a visual guideline at 80 columns so you know when is a good time to insert a newline.
Details on inserting a guideline at 80 characters for 3 different versions of visual studio.

- 14,281
- 7
- 61
- 70
-
Alternative link: http://stackoverflow.com/questions/84209/adding-a-guideline-to-the-editor-in-visual-studio – user9876 Mar 12 '10 at 11:34
You can also use
Ctrl+E, Ctrl+W
keyboard shortcut to toggle wrap lines on and off.
-
Thanks, does it stay enabled for all files forever, or just the session? – eozzy Feb 09 '17 at 23:09
-
thanks for this shortcut...I misstype this a lot and always have to google where to disable it. gonna put this on a post-it not for sure – Mario Garcia Aug 19 '19 at 11:38
To do this with Visual Assist (another non-free tool):
VAssistX >> Visual Assist X Options >> Advanced >> Display
- Check "Display indicator after column" and set the number field to 80.

- 10,975
- 5
- 66
- 107
Adds vertical column guides to the Visual Studio text editor. This version is for Visual Studio 2012, Visual Studio 2013 or Visual Studio 2015.
See the plugin.
If the problem is simply that you want to know when you pass 80 characters for a single line, which is a common coding guideline limit, you can use a different approach: Editor Guidelines. This will add vertical column guides behind your code.

- 3,624
- 8
- 42
- 57
See also this answer in order to switch the mode conveniently.
Citation:
I use this feature often enough that I add a custom button to the command bar.
Click on the Add or Remove -> Customize
Click on the Commands tab
Select Edit|Advanced from the list
Find Toggle Word Wrap and drag it onto your bar

- 1
- 1

- 4,246
- 2
- 43
- 64
You can enable word wrap and set zoom of code for 207% and that will show wrap every line of code that is over 80 characters in length.