Visual Studio Code Tab Key does not insert a tab
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
Introduction
When the Tab key stops inserting tabs in VS Code, the most common cause is that "Tab Moves Focus" mode is turned on. Press Ctrl+M (or Ctrl+Shift+M on macOS) to toggle it off. If that does not fix it, there are several other settings and extensions that can hijack the Tab key. This article covers every cause and the exact fix for each one.
Fix 1: Toggle Off "Tab Moves Focus" (Most Common)
VS Code has an accessibility feature called "Tab Moves Focus" that changes the Tab key from inserting whitespace to cycling between UI elements (sidebar, editor, terminal, etc.). This is the single most common reason the Tab key stops working for indentation.
How to tell if it is active: Look at the status bar at the bottom of VS Code. If you see "Tab Moves Focus" displayed there, this is your problem.
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"
This setting often gets toggled accidentally because Ctrl+M is easy to hit unintentionally.
You can also disable it in settings to prevent accidental toggling:
Fix 2: Disable Emmet Tab Expansion
Emmet is built into VS Code and uses Tab to expand abbreviations (e.g., typing div.container then Tab expands it to <div class="container"></div>). When Emmet intercepts Tab, regular indentation does not happen.
Symptoms: Tab does nothing in non-HTML/CSS files, or inserts unexpected HTML markup.
Fix:
After disabling this, Emmet still works. You just need to use Ctrl+Space or the suggestion menu to expand abbreviations instead of Tab.
Fix 3: Adjust Tab Completion Settings
VS Code can use Tab to accept autocomplete suggestions and cycle through snippet placeholders. This can conflict with regular indentation.
Settings to check:
| Setting | Options | Effect on Tab Key |
editor.tabCompletion | "on", "off", "onlySnippets" | "on" makes Tab accept any suggestion |
editor.acceptSuggestionOnTab | true, false | Whether Tab accepts the highlighted suggestion |
editor.snippetSuggestions | "top", "bottom", "inline", "none" | Where snippets appear in suggestion list |
If Tab is inserting snippet expansions when you just want indentation, set editor.tabCompletion to "off".
Fix 4: Check for Extension Conflicts
Installed extensions can rebind the Tab key. Common offenders:
| 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 |
How to diagnose:
- 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 disable all extensions and re-enable them one at a time:
If Tab works with extensions disabled, enable them one by one to find the culprit.
Fix 5: Tabs vs. Spaces Configuration
If Tab inserts spaces instead of a tab character, this is by design. VS Code defaults to inserting spaces. To change it:
| 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 |
Quick toggle: Click the "Spaces: 4" or "Tab Size: 4" indicator in the bottom status bar to switch between tabs and spaces for the current file.
Note that editor.detectIndentation can override your settings on a per-file basis. If a file already uses tabs, VS Code switches to tabs for that file even if your default is spaces.
Fix 6: Check Keybinding Conflicts
To see exactly what the Tab key is bound to in your current context:
- 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
You can also check via the Command Palette:
After enabling this, press Tab and check the Developer Tools console (Help > Toggle Developer Tools) to see which command won and which were suppressed.
Resetting Tab to default behavior
If nothing else works, you can explicitly define the Tab key behavior in keybindings.json:
Fix 7: Reset VS Code Settings Entirely
As a last resort, reset all settings to defaults:
- Open Command Palette (
Ctrl+Shift+P) - Type "Preferences: Open User Settings (JSON)"
- Delete all content (or back it up first)
- Save the file
Or reset from the command line:
On macOS, the settings file is at ~/Library/Application Support/Code/User/settings.json. On Windows, it is %APPDATA%\Code\User\settings.json.
Diagnostic Checklist
Run through this list in order when Tab stops working:
- Check status bar for "Tab Moves Focus" indicator. If present, press
Ctrl+M. - Test with extensions disabled:
code --disable-extensions. - Open Keyboard Shortcuts, record Tab key press, check for conflicts.
- Check
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.
Common Pitfalls
- Hitting Ctrl+M accidentally. This is the number one cause.
Ctrl+Mis right next to common shortcuts (Ctrl+N,Ctrl+B), and there is no visual confirmation dialog when toggling it. Train yourself to check the status bar. - Workspace settings overriding user settings. Your project's
.vscode/settings.jsontakes precedence over your user settings. Check both files when troubleshooting. - Confusing "Tab key does nothing" with "Tab inserts spaces". If your file is set to use spaces, Tab works correctly but inserts invisible space characters instead of a visible tab character. Check the status bar for "Spaces" vs "Tabs".
- GitHub Copilot taking over Tab. When Copilot shows a ghost suggestion, Tab accepts the suggestion instead of indenting. Press Escape to dismiss the suggestion first, then Tab will indent as expected.
Summary
- The most common fix is pressing
Ctrl+Mto toggle off "Tab Moves Focus" mode. - Check
emmet.triggerExpansionOnTabandeditor.tabCompletionsettings if Tab triggers expansions instead of indentation. - Use
code --disable-extensionsto isolate extension conflicts. - Use the Keyboard Shortcuts Troubleshooting mode to see exactly which command responds to Tab in your current context.
- Check both user settings and workspace settings (
.vscode/settings.json) since workspace settings override user settings. - When Tab inserts spaces instead of tab characters, that is the default VS Code behavior, not a bug. Change it with
editor.insertSpaces: falseif you need actual tab characters.
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 courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.