Skip to content
CtrlKFind a shortcut

VS Code Shortcut Keys

AppsRun and debugEditing and formatChecked 2 Nov 2026

Command Palette

CtrlShiftP

Terminal

Ctrl`

Run without debugging

CtrlF5

Format document

ShiftAltF

VS Code shortcut keys start with one that leads to all the others: Ctrl + Shift + P opens the Command Palette, where you can type any action, such as format or toggle terminal, and see its key beside it. Ctrl + P jumps to any file by name, and Ctrl + ` opens the built in terminal.

To run code, press F5 to start with the debugger or Ctrl + F5 to run without it. Shift + Alt + F formats the whole file, fixing indentation and alignment. On a Mac, replace Ctrl with Command for most of these.

Quick facts

  • Command Palette

    Ctrl + Shift + P
  • Open file by name

    Ctrl + P
  • Terminal

    Ctrl + `
  • Run with debugger

    F5
  • Run without debugger

    Ctrl + F5
  • Format document

    Shift + Alt + F
  • Toggle comment

    Ctrl + /

VS Code shortcut keys for running code

Running and debugging
KeysAction
F5Start debugging
Ctrl + F5Run without debugging
Shift + F5Stop
F9Toggle breakpoint
F10Step over
F11Step into
Ctrl + `Show or hide the terminal
Ctrl + Shift + `New terminal

The shortcut key to run code in VS Code depends on the language setup. Python and JavaScript files run with Ctrl + F5 once the language extension is installed. Many students also add a popular code runner extension, which uses Ctrl + Alt + N to run the current file and show the output panel. Typing python file.py in the terminal always works as a fallback.

Line editing and multiple cursors

Line and cursor editing
KeysAction
Alt + UpMove line up
Alt + DownMove line down
Shift + Alt + DownCopy line down
Ctrl + Shift + KDelete line
Ctrl + EnterNew line below
Ctrl + /Toggle line comment
Ctrl + DSelect next match of the word
Ctrl + Shift + LSelect all matches
Alt + clickAdd another cursor
Ctrl + Alt + DownAdd cursor on the line below

Multiple cursors are the feature people miss most in other editors. Put the cursor on a variable name, press Ctrl + D a few times to select the next uses, and type the new name; every copy changes at once. For a safe rename across the whole project, use F2 on the name instead.

Visual Studio Code alignment shortcut key

Shift + Alt + F runs Format Document, which aligns indentation, spacing and brackets according to the language's formatter. Ctrl + K followed by Ctrl + F formats only the selection. Ctrl + ] and Ctrl + [ indent and outdent selected lines. Turn on Format On Save in Settings (Ctrl + ,) so every save tidies the file automatically.

If Format Document asks you to choose a formatter, install one for the language, then pick it once as the default.

Visual Studio shortcut keys

The full Visual Studio IDE, used for C# and C++ projects, shares the debugging keys: F5 debug, Ctrl + F5 run, F9 breakpoint and F10 or F11 to step. Building uses Ctrl + Shift + B. Formatting and comments use chords: Ctrl + K then Ctrl + D formats the document, Ctrl + K then Ctrl + C comments a selection and Ctrl + K then Ctrl + U removes the comment.

When a shortcut does not work

Problems and fixes
ProblemFix
Ctrl + ` does nothingOn some layouts the key differs; use View, Terminal
Another extension took the keyOpen Keyboard Shortcuts with Ctrl + K, then Ctrl + S, and search it
Format Document does nothingNo formatter for that language is installed
Alt + arrows switch windowsSome laptop tools use them; change the tool's keys
A student writing a Python assignment keeps the terminal open with Ctrl + `, runs with Ctrl + F5, fixes an error, and presses Shift + Alt + F before submitting so the indentation is clean.

Frequently asked questions

What are the most useful VS Code shortcut keys?

Ctrl + Shift + P, Ctrl + P, Ctrl + ` and Shift + Alt + F.

What is the shortcut key to run code in VS Code?
Ctrl + F5 to run, F5 to debug.
How do I format code in VS Code?
Shift + Alt + F.
How do I comment several lines?

Select them and press Ctrl + /.

How do I edit many lines at once?

Use Ctrl + D or Alt + click for multiple cursors.

How do I see or change VS Code shortcuts?
Ctrl + K, then Ctrl + S.