92 shortcuts · Windows and Mac
VS Code Keyboard Shortcuts
Updated
Visual Studio Code ships with hundreds of default keybindings, and a handful of them account for most of the speed difference between a fast editor user and a slow one. This sheet covers the defaults as installed: the command palette, multi-cursor editing, find and replace, code navigation, editor layout and the debugger. If you have imported a Vim, Sublime or IntelliJ keymap, your bindings will differ — check Keyboard Shortcuts to see what is actually bound.
Platforms covered: Windows and macOS, using the default keybindings that ship with Visual Studio Code — nothing here depends on an extension or a customised keymap.
General
| Windows | Mac | Action |
|---|---|---|
| CtrlShiftP | CmdShiftP | Show the Command Palette |
| CtrlP | CmdP | Quick Open — go to a file by name |
| CtrlN | CmdN | New file |
| CtrlO | CmdO | Open a file |
| CtrlS | CmdS | Save |
| CtrlShiftS | CmdShiftS | Save As |
| CtrlW | CmdW | Close the editor |
| CtrlShiftN | CmdShiftN | Open a new window |
| CtrlShiftW | CmdShiftW | Close the window |
| Ctrl, | Cmd, | Open Settings |
| CtrlKthenCtrlS | CmdKthenCmdS | Open Keyboard Shortcuts |
| CtrlKthenCtrlT | CmdKthenCmdT | Change the colour theme |
Basic editing
| Windows | Mac | Action |
|---|---|---|
| CtrlX | CmdX | Cut the whole line when nothing is selected |
| CtrlC | CmdC | Copy the whole line when nothing is selected |
| AltDown arrow | OptionDown arrow | Move the line down |
| AltUp arrow | OptionUp arrow | Move the line up |
| ShiftAltDown arrow | ShiftOptionDown arrow | Copy the line down |
| ShiftAltUp arrow | ShiftOptionUp arrow | Copy the line up |
| CtrlShiftK | CmdShiftK | Delete the line |
| CtrlEnter | CmdEnter | Insert a new line below |
| CtrlShiftEnter | CmdShiftEnter | Insert a new line above |
| Ctrl] | Cmd] | Indent the line |
| Ctrl[ | Cmd[ | Outdent the line |
| Ctrl/ | Cmd/ | Toggle a line comment |
| ShiftAltA | ShiftOptionA | Toggle a block comment |
| AltZ | OptionZ | Toggle word wrap |
Multi-cursor and selection
| Windows | Mac | Action |
|---|---|---|
| CtrlA | CmdA | Select everything in the file |
| CtrlL | CmdL | Select the current line |
| CtrlD | CmdD | Add the next match of the selection to the cursors |
| CtrlKthenCtrlD | CmdKthenCmdD | Skip this match and move to the next one |
| CtrlU | CmdU | Undo the last cursor operation |
| CtrlF2 | CmdF2 | Select every occurrence of the current word |
| CtrlAltDown arrow | OptionCmdDown arrow | Add a cursor on the line below |
| CtrlAltUp arrow | OptionCmdUp arrow | Add a cursor on the line above |
| ShiftAltI | ShiftOptionI | Add a cursor at the end of every selected line |
| AltClick | OptionClick | Add a cursor wherever you click |
| ShiftAltRight arrow | CtrlShiftCmdRight arrow | Expand the selection to the next syntax level |
| ShiftAltLeft arrow | CtrlShiftCmdLeft arrow | Shrink the selection back |
| CtrlShiftBackslash | CmdShiftBackslash | Jump to the matching bracket |
Search and replace
| Windows | Mac | Action |
|---|---|---|
| CtrlF | CmdF | Find in this file |
| CtrlH | OptionCmdF | Replace in this file |
| F3 | CmdG | Find the next match |
| ShiftF3 | CmdShiftG | Find the previous match |
| AltEnter | OptionEnter | Select every match of the current search |
| CtrlShiftF | CmdShiftF | Search across every file in the folder |
| CtrlShiftH | CmdShiftH | Replace across every file in the folder |
| CtrlShiftJ | CmdShiftJ | Show the search filters and options |
| AltC | OptionCmdC | Toggle case-sensitive matching |
| AltW | OptionCmdW | Toggle whole-word matching |
| AltR | OptionCmdR | Toggle regular-expression matching |
Navigating code
| Windows | Mac | Action |
|---|---|---|
| F12 | F12 | Go to the definition |
| AltF12 | OptionF12 | Peek the definition without leaving the file |
| ShiftF12 | ShiftF12 | Show every reference to the symbol |
| F2 | F2 | Rename the symbol everywhere |
| CtrlT | CmdT | Search every symbol in the project |
| CtrlShiftO | CmdShiftO | Go to a symbol in this file |
| CtrlG | CtrlG | Go to a line number |
| AltLeft arrow | CtrlMinus | Go back to where you were |
| AltRight arrow | CtrlShiftMinus | Go forward again |
| CtrlHome | CmdUp arrow | Jump to the start of the file |
| CtrlEnd | CmdDown arrow | Jump to the end of the file |
| CtrlShiftM | CmdShiftM | Open the Problems panel |
| F8 | F8 | Go to the next error or warning |
| ShiftF8 | ShiftF8 | Go to the previous error or warning |
Editor layout and panels
| Windows | Mac | Action |
|---|---|---|
| CtrlBackslash | CmdBackslash | Split the editor |
| Ctrl1 | Cmd1 | Focus the first editor group |
| Ctrl2 | Cmd2 | Focus the second editor group |
| CtrlKthenCtrlLeft arrow | CmdKthenCmdLeft arrow | Focus the previous editor group |
| CtrlKthenCtrlRight arrow | CmdKthenCmdRight arrow | Focus the next editor group |
| CtrlB | CmdB | Show or hide the side bar |
| CtrlJ | CmdJ | Show or hide the bottom panel |
| CtrlBackquote | CtrlBackquote | Show or hide the integrated terminal |
| CtrlShiftE | CmdShiftE | Open the Explorer |
| CtrlShiftG | CtrlShiftG | Open Source Control |
| CtrlShiftD | CmdShiftD | Open the Run and Debug view |
| CtrlShiftX | CmdShiftX | Open Extensions |
| CtrlShiftU | CmdShiftU | Open the Output panel |
| F11 | CtrlCmdF | Toggle full screen |
Language tools and debugging
| Windows | Mac | Action |
|---|---|---|
| CtrlSpace | CtrlSpace | Trigger the suggestion list |
| CtrlShiftSpace | CmdShiftSpace | Show parameter hints |
| Ctrl. | Cmd. | Show Quick Fixes for the problem under the cursor |
| ShiftAltF | ShiftOptionF | Format the whole document |
| CtrlKthenCtrlF | CmdKthenCmdF | Format just the selection |
| CtrlKthenCtrlI | CmdKthenCmdI | Show the hover documentation |
| CtrlKthenCtrlX | CmdKthenCmdX | Trim trailing whitespace |
| CtrlKthenM | CmdKthenM | Change the language mode of the file |
| F9 | F9 | Toggle a breakpoint on this line |
| F5 | F5 | Start debugging, or continue |
| F10 | F10 | Step over |
| F11 | F11 | Step into |
| ShiftF11 | ShiftF11 | Step out |
| ShiftF5 | ShiftF5 | Stop debugging |
VS Code shortcuts — common questions
- Are these the shortcuts VS Code ships with?
- Yes. Every row is a default keybinding in a fresh Visual Studio Code install, with no extensions and no imported keymap. If you have installed a Vim, Sublime Text or IntelliJ keymap extension, it rebinds large parts of the editor — open Keyboard Shortcuts to see what is actually bound on your machine.
- How do I see and change my own keybindings?
- Press Ctrl + K then Ctrl + S on Windows, or Cmd + K then Cmd + S on a Mac. That opens the Keyboard Shortcuts editor, where you can search by command or by key, and double-click any row to rebind it. The same list is available from the Command Palette by searching for "Open Keyboard Shortcuts".
- What is the single most useful VS Code shortcut?
- The Command Palette — Ctrl + Shift + P, or Cmd + Shift + P on a Mac. Every command in the editor is reachable from it by typing a few letters of its name, and it shows you the keyboard shortcut for each one, so it doubles as a way to learn the rest of this list.
- Do the shortcuts work the same in VS Code for the Web?
- Mostly. vscode.dev runs the same editor, so the editing and navigation shortcuts behave identically. The exceptions are combinations the browser reserves for itself — Ctrl + N, Ctrl + W and Ctrl + Shift + N among them — which the browser handles before the editor ever sees them.