Multiple cursors let you type the same change into several places at once. Instead of editing line by line, you place a cursor everywhere the change needs to go, then type once.
VS Code gives you several ways to add cursors. Each one fits a different situation. If you are learning the full set of editing shortcuts, start with the keyboard shortcuts cheat sheet.
Add a cursor anywhere with Alt+Click
Hold Alt (Windows/Linux) or Opt (macOS) and click anywhere in the editor. A thinner secondary cursor appears at each click. Start typing and every cursor types the same text.
This is the most precise method, since each cursor operates independently based on the text around it. To remove a cursor, Alt+Click it again, or press Escape to remove all secondary cursors at once.
Add cursors above or below
Press Ctrl+Alt+Down (Windows/Linux) or Cmd+Opt+Down (macOS) to add a cursor on the line below. Press Ctrl+Alt+Up / Cmd+Opt+Up to add one above. Each press adds one more cursor, one line at a time.
This works well when you have a list of values that all need the same prefix, suffix, or formatting change.
Select matching words with Ctrl+D
Place your cursor on a word and press Ctrl+D (Windows/Linux) or Cmd+D (macOS). VS Code selects the word and highlights the next occurrence. Press Ctrl+D again to add the next one, and keep pressing until you have selected every occurrence you want to change. Type the replacement and every selected occurrence changes at once.
To skip an occurrence you do not want to change, press Ctrl+K Ctrl+D (Windows/Linux) or Cmd+K Cmd+D (macOS). The current match is deselected and the cursor moves to the next one.
Select all occurrences at once
Select a word or phrase, then press Ctrl+Shift+L (Windows/Linux) or Cmd+Shift+L (macOS). VS Code places a cursor at every occurrence of that text in the file.
This is the fastest way when you want to rename or replace every instance of something. Unlike find-and-replace, you see every cursor inline and can make contextual edits around each one.
Column (box) selection
Column selection lets you select a rectangular block of text that spans multiple lines. Hold Shift+Alt (Windows/Linux) or Shift+Opt (macOS) and drag with the mouse. A rectangle appears and everything inside it is selected. Column selection is useful for:
- Deleting a repeated prefix (like line numbers or timestamps) from multiple lines.
- Copying a rectangular block of aligned text.
- Typing into a column of empty space across several lines.
You can also toggle Column Selection Mode from the Selection menu. When active, the Status Bar shows the mode and arrow keys create column selections without needing the mouse.
Change the multi-cursor modifier
If Alt+Click conflicts with your graphics driver or another tool, VS Code lets you switch to Ctrl+Click. Open the Command Palette and run Selection > Switch to Ctrl+Click for Multi-Cursor. You can also set this permanently: search for editor.multiCursorModifier in the Settings editor and set it to ctrlCmd or alt (the default).
When you switch to Ctrl+Click, Go to Definition moves to Alt+Click so the two gestures do not conflict.
Practical workflows
Add a comma or semicolon to the end of every line
Start at the first line
Put your cursor at the start of the first line.
Add a cursor per line
Press Ctrl+Alt+Down (Cmd+Opt+Down) once for each line you want to edit.
Move to line ends
Press End to move all cursors to the end of their lines.
Type the character
Type a comma or semicolon. It appears at the end of every selected line.
Rename a variable across a function
Select the variable name
Select one instance of the variable name.
Select each occurrence
Press Ctrl+D (Cmd+D) repeatedly to select each occurrence within the function.
Skip unrelated matches
Skip any occurrence that is a different variable with Ctrl+K Ctrl+D (Cmd+K Cmd+D).
Type the new name
Type the new name. Every selected occurrence updates at once.
Wrap a list of values in quotes
Column-select before each value
Use Shift+Alt+drag (Shift+Opt+drag) to column-select in front of every value.
Add the opening quote
Type a quotation mark. Every line gets an opening quote.
Add the closing quote and comma
Press End and type a closing quotation mark and comma. Every line gets both.
Troubleshooting
If Ctrl+D selects the wrong word, check that the word is identical. Case matters: "Name" and "name" are different. Toggle Match Case (Alt+C) in the Find control if you want case-sensitive matching. The multi-cursor Ctrl+D always matches case.
If Alt+Click does nothing, an extension or graphics driver may be consuming the shortcut. Try Selection > Switch to Ctrl+Click for Multi-Cursor. If that works, your Alt key is in conflict.
If cursor up/down adds cursors on wrapped lines instead of logical lines, you can fix this in keybindings.json. Open the file and add "args": { "logicalLine": true } to your editor.action.insertCursorBelow and editor.action.insertCursorAbove keybindings.
Multi-cursor works everywhere in VS Code: the editor, the terminal, and even inside Emmet abbreviations. Place multiple cursors and expand the same abbreviation on each line. For more on Emmet, see how to use Emmet in VS Code.
Rune AI
Key Insights
- Alt+Click places a cursor anywhere you click. Secondary cursors appear thinner than the primary one.
- Ctrl+D selects the next occurrence of the current word. Press it repeatedly to add more. Use Ctrl+K Ctrl+D to skip an unwanted match.
- Ctrl+Shift+L selects every occurrence of the current selection at once. Best when you want to change all instances.
- Ctrl+Alt+Up and Ctrl+Alt+Down add cursors on the lines above or below the current one.
- Shift+Alt+drag creates a rectangular column selection for editing aligned text or deleting repeated prefixes.
Frequently Asked Questions
What is the difference between Ctrl+D and Ctrl+Shift+L?
My Alt+Click shortcut is not working. What is wrong?
How do I avoid adding cursors on wrapped lines?
Conclusion
Multiple cursors turn a repetitive edit into one action. Alt+Click places cursors anywhere. Ctrl+D selects matching words one at a time. Ctrl+Shift+L grabs every match at once. Column selection edits rectangular blocks. Try inserting cursors above and below with Ctrl+Alt+Up and Ctrl+Alt+Down, then type -- your edit applies to every line at once. Pair this with the keyboard shortcuts cheat sheet to memorize the full shortcut set.
More in this topic
How to Use VS Code with WSL 2 on Windows
Run VS Code connected to Windows Subsystem for Linux so you can develop in a full Linux environment with native tools, terminals, and debugging, all from Windows.
20 Best VS Code Extensions for Web Developers in 2026
Twenty carefully chosen VS Code extensions every web developer should know. Covers formatting, linting, frameworks, debugging, Git, and developer experience.
How to Install, Disable, Update, and Uninstall VS Code Extensions
Learn how to install, disable, update, and uninstall VS Code extensions from the Marketplace and the command line. Step-by-step instructions for every action.