Visual Studio keyboard shortcuts
Visual Studio is Microsoft's IDE for .NET and C++ on Windows. These are the default General profile keys for building, debugging, refactoring and moving around a solution.
Most used Visual Studio keyboard shortcuts
The Visual Studio shortcuts worth learning first. The full list follows, grouped by task.
- Build the solutionCtrlShiftB
- Start debuggingF5
- Start without debuggingCtrlF5
- Toggle a breakpointF9
- Step overF10
- Go to the definitionF12
- Find all referencesShiftF12
- RenameCtrlR,CtrlR
- Quick actions and refactoringsCtrl.orAltEnter
- Go to anything (files, types, members)CtrlTorCtrl,
- Comment the selectionCtrlK,CtrlC
- Format the documentCtrlK,CtrlD
Build and debug
11 shortcuts| Action | Keys |
|---|---|
| Build the solution | CtrlShiftB |
| Start debugging | F5 |
| Start without debugging | CtrlF5 |
| Stop debugging | ShiftF5 |
| Restart debugging | CtrlShiftF5 |
| Toggle a breakpoint | F9 |
| Step over | F10 |
| Step into | F11 |
| Step out | ShiftF11 |
| Run to the cursor | CtrlF10 |
| Apply Hot Reload changesDebugging | AltF10 |
Navigation
13 shortcuts| Action | Keys |
|---|---|
| Go to anything (files, types, members) | CtrlTorCtrl, |
| Search Visual Studio commands and settings | CtrlQ |
| Go to a line | CtrlG |
| Go to the definition | F12 |
| Peek the definition | AltF12 |
| Go to the implementation | CtrlF12 |
| Find all references | ShiftF12 |
| Navigate backward | Ctrl- |
| Navigate forward | CtrlShift- |
| Switch between open documents | CtrlTab |
| Close the document | CtrlF4 |
| Toggle a bookmark | CtrlK,CtrlK |
| Next bookmark | CtrlK,CtrlN |
Editing
19 shortcuts| Action | Keys |
|---|---|
| Quick actions and refactorings | Ctrl.orAltEnter |
| Rename | CtrlR,CtrlR |
| Extract method | CtrlR,CtrlM |
| Comment the selection | CtrlK,CtrlC |
| Uncomment the selection | CtrlK,CtrlU |
| Format the document | CtrlK,CtrlD |
| Format the selection | CtrlK,CtrlF |
| Duplicate the line or selection | CtrlD |
| Delete the line | CtrlShiftL |
| Move the line up | Alt↑ |
| Move the line down | Alt↓ |
| Add the next match to the selection | AltShift. |
| Select every match | AltShift; |
| Show IntelliSense completions | CtrlSpaceorCtrlJ |
| Show parameter info | CtrlShiftSpace |
| Surround with a snippet | CtrlK,CtrlS |
| Insert a snippet | CtrlK,CtrlX |
| Collapse or expand the block | CtrlM,CtrlM |
| Collapse or expand all blocks | CtrlM,CtrlL |
Search and windows
12 shortcuts| Action | Keys |
|---|---|
| Find | CtrlF |
| Replace | CtrlH |
| Find in files | CtrlShiftF |
| Replace in files | CtrlShiftH |
| Show Solution Explorer | CtrlAltL |
| Show the Error List | Ctrl\,E |
| Show the Output window | CtrlAltO |
| Show the terminal | Ctrl` |
| Add a new item | CtrlShiftA |
| New project | CtrlShiftN |
| Save all | CtrlShiftS |
| Full screen | AltShiftEnter |
No shortcuts match. Try fewer words, the key names only, or search every app.
Show the key map: which keys Visual Studio uses mostDarker orange = used by more shortcuts
Comment, format and collapse code in Visual Studio
- Uncomment the selectionCtrlK,CtrlU
- Format the selectionCtrlK,CtrlF
- Collapse or expand the blockCtrlM,CtrlM
- Collapse or expand all blocksCtrlM,CtrlL
- Duplicate the line or selectionCtrlD
- Delete the lineCtrlShiftL
- Move the line upAlt↑
- Move the line downAlt↓
- Add the next match to the selectionAltShift.
- Select every matchAltShift;
- Surround with a snippetCtrlK,CtrlS
- Insert a snippetCtrlK,CtrlX
- Collapse to definitions
- Ctrl+M, Ctrl+O folds every method to its signature; Ctrl+M, Ctrl+L expands or collapses everything.
- Uppercase and lowercase
- Ctrl+Shift+U makes the selection uppercase and Ctrl+U lowercase.
- Remove unused usings
- Ctrl+R, Ctrl+G removes and sorts using directives in the current file.
Build, run and debug shortcuts in Visual Studio
- Stop debuggingShiftF5
- Restart debuggingCtrlShiftF5
- Step intoF11
- Step outShiftF11
- Run to the cursorCtrlF10
- Apply Hot Reload changesAltF10
- Continue
- While stopped at a breakpoint, F5 continues to the next one.
IntelliSense, quick actions and refactoring in Visual Studio
- Show IntelliSense completionsCtrlSpaceorCtrlJ
- Show parameter infoCtrlShiftSpace
- Extract methodCtrlR,CtrlM
- GitHub Copilot
- Tab accepts a grey Copilot suggestion; in recent Visual Studio 2022 versions, Alt+/ opens Copilot Chat inline in the editor.
Solution Explorer, terminal and project shortcuts in Visual Studio
- Show Solution ExplorerCtrlAltL
- Show the Error ListCtrl\,E
- Show the Output windowCtrlAltO
- Show the terminalCtrl`
- Add a new itemCtrlShiftA
- New projectCtrlShiftN
- Save allCtrlShiftS
- Full screenAltShiftEnter
- New class
- Shift+Alt+C adds a new class to the selected project; Ctrl+Shift+A offers every item type.
Change Visual Studio keyboard shortcuts and schemes
- Change a shortcut
- Tools > Options > Environment > Keyboard: find the command, click in Press shortcut keys, press the keys and choose Assign.
- Use VS Code keys
- The mapping scheme menu on the same page switches to the Visual Studio Code or Visual C# 2005 schemes. Reset puts the default keys back.
Visual Studio keyboard shortcuts: questions
- How do I comment out code in Visual Studio?
- Select the lines and press Ctrl+K then Ctrl+C. Ctrl+K then Ctrl+U removes the comment. Ctrl+K then Ctrl+/ toggles it.
- Why are Visual Studio keyboard shortcuts not working?
- Check Tools > Options > Environment > Keyboard for a changed mapping scheme, and that an extension (such as ReSharper) has not replaced the keys. Two-step shortcuts like Ctrl+K, Ctrl+C need both steps; the status bar shows when Visual Studio is waiting for the second.
These are the default key bindings in Microsoft Visual Studio 2022 (17.14), as published by Microsoft. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.
Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.