| title | Configure indent and tab settings | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | Learn how to use the Tabs page in the All Languages section to change the default behavior of the code editor tabs within Visual Studio. | ||||||||||||||||||||||||
| ms.date | 11/14/2025 | ||||||||||||||||||||||||
| ms.topic | reference | ||||||||||||||||||||||||
| f1_keywords |
|
||||||||||||||||||||||||
| helpviewer_keywords |
|
||||||||||||||||||||||||
| ms.custom | ide-ref | ||||||||||||||||||||||||
| author | anandmeg | ||||||||||||||||||||||||
| ms.author | meghaanand | ||||||||||||||||||||||||
| manager | mijacobs | ||||||||||||||||||||||||
| ms.subservice | general-ide |
Learn how to change the default tab and indentation behavior for the Code Editor in Visual Studio by using the text editor configuration options.
:::moniker range="visualstudio"
In Visual Studio, open the Tools > Options pane, and expand the All Settings > Languages > Defaults > Tabs section.
Caution
Changes made here apply to all development languages. Resetting options in this dialog overrides individual language settings. To configure options for a specific language, select its subfolder under All Settings > Languages > Language (such as C# or Visual Basic) > Tabs.
:::moniker-end :::moniker range="<=vs-2022"
In Visual Studio, open the Tools > Options dialog, and expand the Text Editor > All Languages > Tabs section.
Caution
Changes made here apply to all development languages. Resetting options in this dialog overrides individual language settings. To configure options for a specific language, select its subfolder under Text Editor.
:::moniker-end
If you select different tab or indent settings for individual languages, Visual Studio displays a warning message:
- "The indentation settings for individual text formats conflict with each other," for differing Indenting options.
- "The tab settings for individual text formats conflict with each other," for differing Tab options.
For example, if Smart indenting is set for Visual Basic and Block indenting for Visual C++, you receive a reminder about the conflict.
For the Indenting option, choose one of the following indenting styles:
- None: New lines aren't indented; the cursor starts at the first column.
- Block: New lines are automatically indented to match the previous line.
- Smart: New lines are indented based on code context and IntelliSense conventions. Not available for all languages.
For example, lines between braces { } might be indented an extra tab stop.
Configure the following tab options:
-
Tab size: Sets the number of spaces per tab stop (default: 4).
-
Indent size: Sets the number of spaces for each indentation (default: 4). Tabs, spaces, or both are used to fill the size.
:::moniker range="visualstudio"
-
Tab character: Select the type of tab character to apply:
- Insert spaces: Indent operations insert only space characters.
- Keep tabs: Indent operations insert as many tab characters as possible; spaces fill any remainder.
:::moniker-end :::moniker range="<=vs-2022"
-
Insert spaces: Indent operations insert only space characters.
-
Keep tabs: Indent operations insert as many tab characters as possible; spaces fill any remainder.
:::moniker-end
:::moniker range="visualstudio"
Tip
Adaptive formatting might override your custom tab settings. To disable adaptive formatting, go to the All Settings > Text Editor > Advanced section in the Tools > Options pane. Toggle the Adaptive formatting option. You can also use an .editorconfig file to manage indent styles.
:::moniker-end :::moniker range="<=vs-2022"
Tip
Adaptive formatting might override your custom tab settings. To disable adaptive formatting, go to the Text Editor > Advanced section in the Tools > Options dialog. Toggle the Use adaptive formatting option. You can also use an .editorconfig file to manage indent styles.
:::moniker-end