VS Code Tab key not working (does not insert a tab)
Codemia Knowledge Hub ·
When the Tab key stops inserting tabs in VS Code, "Tab Moves Focus" mode is usually turned on. Press Ctrl+M (or Ctrl+Shift+M on macOS) to toggle it off. If that does not help, a setting or extension is probably hijacking Tab; the causes and fixes are below.
Turn off Tab Moves Focus (most common cause)
"Tab Moves Focus" is an accessibility feature that makes Tab cycle between UI elements (sidebar, editor, terminal, etc.) instead of inserting whitespace.
How to tell: the status bar at the bottom of VS Code shows "Tab Moves Focus" while it is active.
How to fix it:
- Keyboard shortcut: Press
Ctrl+M(Windows/Linux) orCtrl+Shift+M(macOS) - Command Palette:
Ctrl+Shift+Pand search for "Toggle Tab Key Moves Focus"
It is often toggled by accident because Ctrl+M is easy to hit. To keep it off in settings:
Disable Emmet Tab expansion
Emmet is built into VS Code and uses Tab to expand abbreviations (typing div.container then Tab gives <div class="container"></div>). When Emmet intercepts Tab, indentation does not happen.
Symptoms: Tab does nothing in non-HTML/CSS files, or inserts unexpected HTML markup.
Fix:
Emmet still works afterward; expand abbreviations with Ctrl+Space or the suggestion menu instead of Tab.
Tab completion and suggestion settings
Tab can also accept autocomplete suggestions and cycle through snippet placeholders, which conflicts with indentation.
| Setting | Options | Effect on Tab Key |
editor.tabCompletion | "on", "off", "onlySnippets" | "on" makes Tab accept any suggestion |
editor.snippetSuggestions | "top", "bottom", "inline", "none" | Where snippets appear in suggestion list |
If Tab expands snippets when you only want indentation, set editor.tabCompletion to "off".
Extensions that rebind Tab
| Extension | Tab Behavior | Fix |
| Vim / Neovim | Tab mapped to Vim commands | Check extension keybindings |
| TabOut | Tab jumps out of brackets | Disable or configure tabout.enable |
| Bracket Pair Colorizer | Can interfere in some versions | Update or remove |
| IntelliCode | Tab accepts AI suggestions | Set editor.inlineSuggest.enabled |
| GitHub Copilot | Tab accepts AI completions | "editor.inlineSuggest.enabled": false to test |
To find the conflict:
- Open Command Palette (
Ctrl+Shift+P) - Type "Developer: Open Keyboard Shortcuts (JSON)"
- Search for
"tab"to see all Tab key bindings - Look for conflicting bindings from extensions
Or start with every extension disabled:
If Tab works then, re-enable extensions one at a time to find the culprit.
Tab inserts spaces instead of a tab character
This is the default, not a bug: VS Code inserts spaces. The relevant settings:
| Setting | Default | What It Does |
editor.insertSpaces | true | Tab key inserts spaces (not \t character) |
editor.tabSize | 4 | Number of spaces per Tab press |
editor.detectIndentation | true | Overrides above settings based on file content |
Set editor.insertSpaces to false if you need real tab characters. To switch just the current file, click the "Spaces: 4" or "Tab Size: 4" indicator in the status bar.
editor.detectIndentation can override your settings per file: if a file already uses tabs, VS Code uses tabs for it even when your default is spaces.
Finding which command Tab is bound to
- Open Keyboard Shortcuts (
Ctrl+K Ctrl+S) - Click the "Record Keys" button (keyboard icon)
- Press Tab
- See all commands bound to Tab and their "when" conditions
Or enable troubleshooting mode from the Command Palette:
Then press Tab and check the Developer Tools console (Help > Toggle Developer Tools) to see which command won and which were suppressed.
Restoring the default Tab binding
If nothing else works, define Tab explicitly in keybindings.json:
Resetting VS Code settings (last resort)
- Open Command Palette (
Ctrl+Shift+P) - Type "Preferences: Open User Settings (JSON)"
- Delete all content (or back it up first)
- Save the file
Or from the command line:
On macOS the settings file is ~/Library/Application Support/Code/User/settings.json; on Windows it is %APPDATA%\Code\User\settings.json.
Checklist when Tab stops working
- Check the status bar for "Tab Moves Focus". If present, press
Ctrl+M. - Test with extensions disabled:
code --disable-extensions. - Open Keyboard Shortcuts, record a Tab press, check for conflicts.
- Check the
editor.tabCompletionandemmet.triggerExpansionOnTabsettings. - Look for
editor.tabFocusModein your settings.json. - Check workspace settings (
.vscode/settings.json), which override user settings. - If nothing works, reset settings to defaults.
Easy-to-miss causes
- Accidental
Ctrl+M. The top cause. It sits next to common shortcuts (Ctrl+N,Ctrl+B) and toggles with no confirmation, so check the status bar. - Workspace settings. A project's
.vscode/settings.jsontakes precedence over user settings, so check both. - "Does nothing" vs. "inserts spaces." In a file set to spaces, Tab works but inserts invisible spaces. The status bar shows "Spaces" or "Tabs."
- GitHub Copilot ghost text. While a suggestion is showing, Tab accepts it instead of indenting. Press Escape to dismiss it first.
Related reading
- Visual Studio compiles fine, but it still shows red lines
- Visual Studio, debug one of multiple threads
- Visual Studio Is there a way to collapse all items of Solution Explorer?
- Visual Studio jump to next error shortcut?
- Visual Studio popup the operation could not be completed
- Volume is already exclusively attached to one node and can't be attached to another
- Visual studio long compilation when replacing int with double
- Volatile vs. Interlocked vs. lock

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData Structures & Algorithms practice on Codemia
Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.