There are a couple of ways to get a split view in Visual Studio.  Both are incredible time savers that I use daily.  The first is one that most developers will be aware of, but the second seems to be one that many do not seem to know about.

Viewing Two Files in a Split View

Let's say you have two classes you want to compare side by side:

Move your mouse over the Class1 tab and click and drag to anywhere on the window.  When you let go, Visual Studio will prompt you on whether you wish to open a new horizontal tab group or a new vertical tab group:

As you might expect, a new horizontal tab group will split your screen horizontally, and a new vertical tab group will split your screen vertically.  For most developers, I would say a horizontal split makes more sense so you don't have to scroll to see the end of your lines:

This is a very convenient way to compare and edit files side by side.  I have seen several developers take advantage of this feature and it's a great alternative to switching back and forth via the tabs or keyboard shortcuts.

Viewing the Same File in a Split View

What I haven't seen many developers take advantage of however, is a technique I use nearly as often: splitting the same file in Visual Studio.  Let's say you have a single file that is relatively long:

If you want to compare code from one section of this file to another, normally you would have to set bookmarks or just manually scroll back and forth to see both sections of the code.  However, if you hover your mouse over the region right above the scroll bar, you will notice your mouse icon changes from the pointer to the vertical resize tool:

Now if you click and drag down, you'll get a split view of your current file!

Both sections of the split view are editable and will update each other in real time.  When you're done, simply drag the divider all the way to the top and you're back to the normal view! 

This feature comes in very handy when you have long functions or classes and want to compare sections of the code (e.g. reviewing object instantiation before using the object, looking over similar business logic that you want to mimic, etc.).  This feature is available in Visual Studio 2005 and 2008 (and possibly earlier versions, if anyone can confirm please let me know).

24 responses to Visual Studio Tip: Split Views

  1. John S. said:

    For the first one, you only need to right click on the tab to show the split options (below the others), not right-click and drag.

  2. Kevin Pang said:

    Ah, good to know! Thanks John!

  3. Splitting the same file is available in VS 2003, and I even think it’s in VB 6. I use it on a daily basis.
    Same feature exist in Word too.

  4. Pete said:

    Dude, you can also just double-click the little thingy, instead of dragging it, on the "Viewing the Same File in a Split View". Then you get a perfect 50/50 split of the window. Also, double-click the margin again to hide the split.

    Seriously, this is a bit basic. For the audience of this information you really should link to some "Learn basic Visual Studio"-pages and/or videos.


  5. Kevin, just ignore Pete’s crappy attitude. I’ve been using Visual Studio for years – all the way back to VB6 and I didn’t know about splitting the same code file. I knew about the first one (tab groups), but not the second.

    I appreciate the info.


  6. Kevin Pang said:


    I’m glad you found it useful! I had a similar reaction from one of my coworkers the other day, hence why I decided to blog it. :-)

  7. LIming Xu said:

    I’m so glad and embarrassed at the same time to find out about this just now.

    I remember I used to complain about VS 2005 not having a split view that other editors have. I’m so wrong.

    Thanks Kevin, your blog is full of useful bits.

  8. Kevin Pang said:

    @Llming Xu

    No problem. I’m glad you found the tip helpful. :-)

  9. Ryan G. said:

    Is there any way to split the same file vertically instead of horizontally? On my 15.4" laptop I think I can see more code with less scrolling using two vertical panes instead of two narrow horizontal ones. Any ideas guys?

  10. Kevin Pang said:


    As far as I know there isn’t a way to do this, but I’ve been wrong before.

  11. Ashwin said:


    Move the focus to the file that you want to be split. Then select Window->New Window from the menu.

  12. Ryan G said:

    Ashwin, that worked like a charm! Just what I was looking for. Thanks much!

  13. MrPloops said:

    Hi there.
    I have two screens and have visual studio expandet over them. I use Vertical tabs with the form on one and the code on the other.
    I can resize the tabs so they fit a screen each using the mouse.
    Does anybody now a way to resize the tabs using the keyboard?

  14. mikedepetris said:

    Any shortcut to change split view with the keyboard?

  15. MrPloops said:

    Hi Mike.
    First go to Tools-Options and expand Environment and select Keyboard.
    In the ‘Show commands containing’ type window.split. Give it at shortcut (like Shift-Alt-S). Use this to add new tab. Type window.nextsplit and make a new shortcut (like Shift-Alt-N) to hop from one pane to the next.

  16. mikedepetris said:

    Thank you, in fact I discovered it’s F6 but I had to load "default" key combination instead of "Visual C# 2005" I was using.

    I’m still looking for a key to split/unsplit the code window

  17. Feniks said:

    cool stuff man
    The same goes for SQL Server Management Studio

  18. Epiphone said:

    same here still looking for key to split the code

  19. Pankaj said:

    Thanks Kevin and Jhon for the information!!!!

  20. Hello mike , you can also perform operation in a new method like go to Tools-Options and expand Environment and select Keyboard.Thats it.

  21. ford said:

    Any shortcut to change split view with the keyboard?

  22. piyush said:

    thanks, it helped

  23. orip said:

    Awesome, I was looking for this feature

  24. quantumslip said:

    Just wanted to thank you for pointing out this feature! Wish I had know about it before!