This VS Code shortcuts cheat sheet lists the default keyboard shortcuts of Visual Studio Code for Windows and Mac in one table, with the Linux keys noted wherever they differ. It covers the shortcuts that change how fast you edit, such as Ctrl+D to add the next match to a multi-cursor selection, Alt+Up and Down to move lines, F2 to rename a symbol everywhere and Ctrl+Shift+P for the Command Palette, plus the chords (Ctrl+K, then another key) that are hard to discover on your own.
Everything was checked on 2026-10-18 against code.visualstudio.com: the official keyboard shortcut reference sheets for Windows, macOS and Linux and the current documentation, which wins where the two disagree. These are defaults for a US keyboard layout. Extensions, keymaps (Vim, IntelliJ, Sublime) and your own keybindings.json override them, so if a shortcut does something else on your machine, check the Keyboard Shortcuts editor with Ctrl+K Ctrl+S.
How to use
- Pick a category chip (Multi-cursor, Search, Terminal...) or scroll the full list.
- Search by action ("duplicate line") or by keys ("shift alt down").
- For chords like Ctrl+K then Ctrl+S, press the first pair, release, then press the second.
- On Linux, use the Windows column unless the row has a "Linux:" note.
- Copy a shortcut, link to a row, or print the sheet as a PDF.
Frequently asked questions
How do I open the Command Palette in VS Code?
Press Ctrl+Shift+P on Windows and Linux or Cmd+Shift+P on a Mac. F1 works on all three. The Command Palette lists every command with its current shortcut, so it is also the quickest way to look one up. Ctrl+P (Cmd+P) opens Quick Open for files instead.
How do I use multiple cursors in VS Code?
Alt+Click (Option+Click on Mac) adds a cursor where you click. Ctrl+Alt+Up or Down (Cmd+Option+Up/Down on Mac, Shift+Alt+Up/Down on Linux) adds one on the line above or below. Ctrl+D (Cmd+D) selects the word and then each next occurrence, and Ctrl+Shift+L (Cmd+Shift+L) selects all occurrences at once. Ctrl+U undoes the last cursor you added.
What is the shortcut to format code in VS Code?
Shift+Alt+F on Windows, Shift+Option+F on a Mac and Ctrl+Shift+I on Linux formats the whole document with the formatter set for that language. To format only the selection, press Ctrl+K then Ctrl+F (Cmd+K then Cmd+F).
How do I comment out lines in VS Code?
Ctrl+/ (Cmd+/ on Mac) toggles a line comment on the current line or every selected line. Shift+Alt+A (Shift+Option+A on Mac, Ctrl+Shift+A on Linux) toggles a block comment around the selection.
How do I duplicate a line in VS Code?
Shift+Alt+Down copies the line below and Shift+Alt+Up above on Windows; on a Mac use Shift+Option+Down or Up, and on Linux Ctrl+Shift+Alt+Down or Up. Without Shift, Alt+Up and Alt+Down move the line instead of copying it.
How do I change or reset a keyboard shortcut in VS Code?
Open the Keyboard Shortcuts editor with Ctrl+K then Ctrl+S (Cmd+K then Cmd+S), search for the command, double-click it and press the new keys. To edit the JSON file directly, select the Open Keyboard Shortcuts (JSON) button at the top right of that editor. Right-click an entry for Remove Keybinding or Show Same Keybindings, which reveals conflicts.
The VS Code shortcuts that save the most time
Shortcuts for opening menus save seconds; these save minutes because they replace whole manual edits (Windows keys first, Mac in brackets):
• Ctrl+D (Cmd+D): select the next occurrence of the word for a quick multi-cursor rename
• Alt+Up / Down (Option+Up / Down): move the line; add Shift to copy it
• Ctrl+Shift+K (Cmd+Shift+K): delete the line without selecting it
• F2: rename a symbol across the project, not just in the file
• F12 and Alt+F12 (Option+F12): go to or peek at a definition; Alt+Left (Ctrl+- on Mac) jumps back
• Ctrl+. (Cmd+.): Quick Fix, for missing imports and lint fixes
• Ctrl+P (Cmd+P) and Ctrl+Shift+O (Cmd+Shift+O): open a file, then jump to a symbol in it
• Ctrl+G (Ctrl+G on Mac too): go to a line number from an error message
• Ctrl+` (Ctrl+` on Mac too): toggle the terminal; Ctrl+J (Cmd+J) toggles the whole panel
Chords: why some shortcuts need two steps
VS Code runs out of single combinations, so many commands start with Ctrl+K (Cmd+K on Mac) and wait for a second key. Press Ctrl+K, let go, then press the second part; VS Code waits for it. Ctrl+K Ctrl+S opens the Keyboard Shortcuts editor, Ctrl+K Ctrl+T the theme picker, Ctrl+K Z Zen Mode, Ctrl+K V a Markdown preview to the side and Ctrl+K Ctrl+0 folds everything.
Watch whether the second key needs Ctrl as well. Ctrl+K M (no Ctrl on the M) changes the file's language mode, while Ctrl+K Ctrl+M maximizes the editor group. This sheet writes each step out in full.
Linux and other keyboard layouts
On Linux VS Code mostly uses the Windows keys, with a few changes where the desktop environment already owns a combination. The ones to know:
• Format document: Ctrl+Shift+I instead of Shift+Alt+F
• Add cursor above/below: Shift+Alt+Up/Down instead of Ctrl+Alt+Up/Down
• Copy line up/down: Ctrl+Shift+Alt+Up/Down
• Block comment: Ctrl+Shift+A; Peek Definition: Ctrl+Shift+F10
• Go back / forward: Ctrl+Alt+- and Ctrl+Shift+-
• Terminal copy and paste: Ctrl+Shift+C and Ctrl+Shift+V
VS Code's own documents render shortcuts for a US layout. On other layouts, keys such as [, ] and / can sit elsewhere; the Keyboard Shortcuts editor shows the keys for your actual layout.
