The VS Code shortcut to learn first is the Command Palette, Ctrl+Shift+P on Windows and Linux or Cmd+Shift+P on macOS, because it finds every command and shows its shortcut next to the name. After that, Ctrl+P (go to file), Ctrl+D (select next match), Alt+Up/Down (move line) and Ctrl+/ (toggle comment) cover most daily editing.
All shortcuts below are VS Code's defaults, taken from Microsoft's official printable reference sheets. On macOS, Ctrl usually becomes Cmd, but not always, so the tables list both. If you have installed a keymap extension or changed bindings, yours may differ; the Keyboard Shortcuts editor (Ctrl+K Ctrl+S) shows what is actually active.
How to read the shortcuts
Ctrl+Shift+Pmeans hold Ctrl and Shift, then press P.Ctrl+K Ctrl+Sis a chord: pressCtrl+K, let go, then pressCtrl+S.- On macOS,
Optionis the Alt key andCmdis the Command key.
General and finding things
| Action | Windows / Linux | macOS |
|---|---|---|
| Command Palette | Ctrl+Shift+P or F1 | Cmd+Shift+P or F1 |
| Quick Open, go to file | Ctrl+P | Cmd+P |
| Go to line | Ctrl+G | Ctrl+G |
| Go to symbol in file | Ctrl+Shift+O | Cmd+Shift+O |
| Show all symbols | Ctrl+T | Cmd+T |
| Settings | Ctrl+, | Cmd+, |
| Keyboard Shortcuts editor | Ctrl+K Ctrl+S | Cmd+K Cmd+S |
| Find in file / Replace | Ctrl+F / Ctrl+H | Cmd+F / Option+Cmd+F |
| Search across files | Ctrl+Shift+F | Cmd+Shift+F |
| Replace across files | Ctrl+Shift+H | Cmd+Shift+H |
In Quick Open, type ? to see the other things it can do besides opening files.
Line editing
| Action | Windows | macOS |
|---|---|---|
| Move line up / down | Alt+Up / Alt+Down | Option+Up / Option+Down |
| Copy line up / down | Shift+Alt+Up / Shift+Alt+Down | Shift+Option+Up / Shift+Option+Down |
| Delete line | Ctrl+Shift+K | Cmd+Shift+K |
| Cut / copy whole line (nothing selected) | Ctrl+X / Ctrl+C | Cmd+X / Cmd+C |
| Insert line below / above | Ctrl+Enter / Ctrl+Shift+Enter | Cmd+Enter / Cmd+Shift+Enter |
| Indent / outdent line | Ctrl+] / Ctrl+[ | Cmd+] / Cmd+[ |
| Toggle line comment | Ctrl+/ | Cmd+/ |
| Toggle block comment | Shift+Alt+A | Shift+Option+A |
| Jump to matching bracket | Ctrl+Shift+\ | Cmd+Shift+\ |
| Toggle word wrap | Alt+Z | Option+Z |
| Fold / unfold region | Ctrl+Shift+[ / Ctrl+Shift+] | Option+Cmd+[ / Option+Cmd+] |
The "nothing selected" row is worth knowing: with no selection, Ctrl+C copies the entire current line and Ctrl+X cuts it.
Multi-cursor and selection
Multi-cursor editing is where VS Code saves the most time: rename a variable in five places at once, or add a comma to the end of 20 lines.
| Action | Windows | macOS |
|---|---|---|
| Add selection to next match | Ctrl+D | Cmd+D |
| Select all occurrences of the selection | Ctrl+Shift+L | Cmd+Shift+L |
| Insert cursor with the mouse | Alt+Click | Option+Click |
| Insert cursor above / below | Ctrl+Alt+Up / Ctrl+Alt+Down | Option+Cmd+Up / Option+Cmd+Down |
| Cursor at end of each selected line | Shift+Alt+I | Shift+Option+I |
| Undo last cursor operation | Ctrl+U | Cmd+U |
| Select current line | Ctrl+L | Cmd+L |
| Expand / shrink selection | Shift+Alt+Right / Shift+Alt+Left | Ctrl+Shift+Cmd+Right / Left |
| Column (box) selection | Shift+Alt + drag | Shift+Option + drag |
A typical sequence: double-click a word, press Ctrl+D a few times to pick up the next matches (Ctrl+K Ctrl+D moves the last selection on to the following match, which skips one), then type to change them all. Press Esc to go back to a single cursor.
Code navigation and refactoring
| Action | Windows | macOS |
|---|---|---|
| Go to definition | F12 | F12 |
| Peek definition | Alt+F12 | Option+F12 |
| Show references | Shift+F12 | Shift+F12 |
| Rename symbol | F2 | F2 |
| Quick Fix | Ctrl+. | Cmd+. |
| Trigger suggestion | Ctrl+Space | Ctrl+Space |
| Format document | Shift+Alt+F | Shift+Option+F |
| Go back / forward | Alt+Left / Alt+Right | Ctrl+- / Ctrl+Shift+- |
| Next / previous error | F8 / Shift+F8 | F8 / Shift+F8 |
| Problems panel | Ctrl+Shift+M | Cmd+Shift+M |
Rename symbol (F2) renames the symbol itself rather than matching text, so it is the tool for renaming variables and functions; find-and-replace also hits comments and unrelated words with the same spelling.
Editors, panels and the terminal
| Action | Windows | macOS |
|---|---|---|
| Show integrated terminal | Ctrl+` | Ctrl+` |
| New terminal | Ctrl+Shift+` | Ctrl+Shift+` |
| Toggle sidebar | Ctrl+B | Cmd+B |
| Explorer | Ctrl+Shift+E | Cmd+Shift+E |
| Source Control | Ctrl+Shift+G | Ctrl+Shift+G |
| Extensions | Ctrl+Shift+X | Cmd+Shift+X |
| Split editor | Ctrl+\ | Cmd+\ |
| Focus editor group 1 / 2 / 3 | Ctrl+1 / 2 / 3 | Cmd+1 / 2 / 3 |
| Close editor | Ctrl+F4 or Ctrl+W | Cmd+W |
| Reopen closed editor | Ctrl+Shift+T | Cmd+Shift+T |
| Save all | Ctrl+K S | Option+Cmd+S |
| Zen Mode | Ctrl+K Z (Esc Esc to exit) | Cmd+K Z |
| Markdown preview to the side | Ctrl+K V | Cmd+K V |
Debugging uses the function keys on every platform: F9 toggles a breakpoint, F5 starts or continues, F10 steps over, F11 steps into and Shift+F11 steps out, and Shift+F5 stops.
Linux differences
Linux mostly matches Windows, but Microsoft's Linux sheet lists a few different defaults:
| Action | Windows | Linux |
|---|---|---|
| Format document | Shift+Alt+F | Ctrl+Shift+I |
| Insert cursor above / below | Ctrl+Alt+Up/Down | Shift+Alt+Up/Down |
| Toggle block comment | Shift+Alt+A | Ctrl+Shift+A |
| Go back / forward | Alt+Left/Right | Ctrl+Alt+- / Ctrl+Shift+- |
| Copy / paste in the terminal | Ctrl+C / Ctrl+V | Ctrl+Shift+C / Ctrl+Shift+V |
| Close window | Ctrl+Shift+W | Ctrl+W |
The Linux sheet also notes that the Alt+Click gesture may not work on some distributions. You can switch the multi-cursor modifier to Ctrl+Click with the editor.multiCursorModifier setting.
Change or add a shortcut
- Open the Keyboard Shortcuts editor with
Ctrl+K Ctrl+S(Cmd+K Cmd+S), or File > Preferences > Keyboard Shortcuts. - Search for the command, double-click it, press the keys you want, then
Enter. - To check for clashes, right-click the entry and choose Show Same Keybindings.
For more control, the Open Keyboard Shortcuts (JSON) button in the editor's title bar opens keybindings.json, where each rule has a key, a command and an optional when condition:
[
{ "key": "ctrl+shift+d", "command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly" },
{ "key": "tab", "command": "-jumpToNextSnippetPlaceholder" }
]
The first rule binds a new key to "copy line down" only while you are typing in an editable file. The second shows the documented way to remove a default binding: a minus sign before the command name. If a shortcut does nothing, run Developer: Toggle Keyboard Shortcuts Troubleshooting from the Command Palette; the Output panel then logs which keys VS Code received and which command, if any, they triggered.
If you pair these shortcuts with an AI assistant in the editor, how to use AI for coding covers a workflow that keeps you in control of the changes.
Frequently asked questions
- How do I see all VS Code keyboard shortcuts?
- Open the Keyboard Shortcuts editor with Ctrl+K Ctrl+S on Windows and Linux or Cmd+K Cmd+S on macOS, or select File > Preferences > Keyboard Shortcuts. It lists every command with its current binding and lets you search by command name or by pressing the keys. Help > Keyboard Shortcut Reference opens Microsoft's printable PDF for your platform.
- Why doesn't a VS Code shortcut work?
- Usually another binding or an extension has taken the same keys, or the shortcut only applies in a certain context, such as when the editor has focus. Right-click the entry in the Keyboard Shortcuts editor and choose Show Same Keybindings to find conflicts, or run Developer: Toggle Keyboard Shortcuts Troubleshooting from the Command Palette to log which command each key press triggers.
- How do I reset or remove a VS Code shortcut?
- In the Keyboard Shortcuts editor, right-click the entry and choose Remove Keybinding, or reset it to the default from the same menu. In keybindings.json, you remove a default binding by adding a rule with a minus sign before the command name, for example { "key": "tab", "command": "-jumpToNextSnippetPlaceholder" }.
- What does Ctrl+K Ctrl+S mean?
- It is a chord: press Ctrl+K, release, then press Ctrl+S. VS Code waits for the second key after the first. Many VS Code shortcuts start with Ctrl+K (Cmd+K on macOS) in this way, such as Ctrl+K Ctrl+C to add a line comment.