|
| 1 | +--- |
| 2 | +title: Configure indent and tab settings |
| 3 | +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. |
| 4 | +ms.date: 08/08/2025 |
| 5 | +ms.topic: reference |
| 6 | +f1_keywords: |
| 7 | +- VS.ToolsOptionsPages.Text_Editor.All_Languages.Tabs |
| 8 | +- VS.ToolsOptionsPages.Text_Editor.Basic.Tabs |
| 9 | +- VS.ToolsOptionsPages.Text_Editor.CSharp.Tabs |
| 10 | +- VS.ToolsOptionsPages.Text_Editor.C%2FC%2B%2B.Tabs |
| 11 | +- VS.ToolsOptionsPages.Text_Editor.CoffeeScript.Tabs |
| 12 | +- VS.ToolsOptionsPages.Text_Editor.CSS.Tabs |
| 13 | +- VS.ToolsOptionsPages.Text_Editor.Dockerfile.Tabs |
| 14 | +- VS.ToolsOptionsPages.Text_Editor.F%2523.Tabs |
| 15 | +- VS.ToolsOptionsPages.Text_Editor.HQL.Tabs |
| 16 | +- VS.ToolsOptionsPages.Text_Editor.HTML.Tabs |
| 17 | +- VS.ToolsOptionsPages.Text_Editor.HTMLX.Tabs |
| 18 | +- VS.ToolsOptionsPages.Text_Editor.JavaScript.Tabs |
| 19 | +- VS.ToolsOptionsPages.Text_Editor.TypeScript.Tabs |
| 20 | +- VS.ToolsOptionsPages.Text_Editor.JSON.Tabs |
| 21 | +- VS.ToolsOptionsPages.Text_Editor.LESS.Tabs |
| 22 | +- VS.ToolsOptionsPages.Text_Editor.Plain_Text.Tabs |
| 23 | +- VS.ToolsOptionsPages.Text_Editor.ResJSON.Tabs |
| 24 | +- VS.ToolsOptionsPages.Text_Editor.SCSS.Tabs |
| 25 | +- VS.ToolsOptionsPages.Text_Editor.SQL_Server_Tools.Tabs |
| 26 | +- VS.ToolsOptionsPages.Text_Editor.StreamAnalytics.Tabs |
| 27 | +- VS.ToolsOptionsPages.Text_Editor.T-SQL90.Tabs |
| 28 | +- VS.ToolsOptionsPages.Text_Editor.U-SQL.Tabs |
| 29 | +- VS.ToolsOptionsPages.Text_Editor.XAML.Tabs |
| 30 | +- VS.ToolsOptionsPages.Text_Editor.XML.Tabs |
| 31 | +helpviewer_keywords: |
| 32 | +- indents, Code Editor |
| 33 | +- Code Editor, default behavior |
| 34 | +- tabs, setting in Code Editor |
| 35 | +- All Languages Text Editor Options dialog box |
| 36 | +- editors, Code Editor |
| 37 | +- Code Editor, indenting |
| 38 | +- Code Editor, tabs |
| 39 | +ms.custom: "ide-ref" |
| 40 | +author: anandmeg |
| 41 | +ms.author: meghaanand |
| 42 | +manager: mijacobs |
| 43 | +ms.subservice: general-ide |
| 44 | +--- |
| 45 | +# Configure indent and tab settings in Visual Studio |
| 46 | + |
| 47 | +Learn how to change the default tab and indentation behavior for the Code Editor in Visual Studio using the text editor configuration options. |
| 48 | + |
| 49 | +## Access the All Languages Tabs options |
| 50 | + |
| 51 | +1. Open Visual Studio. |
| 52 | +2. On the menu bar, select **Tools** > **Options**. |
| 53 | +3. In the Options dialog, expand the **Text Editor** node. |
| 54 | +4. Expand **All Languages**, then select **Tabs**. |
| 55 | + |
| 56 | +> [!CAUTION] |
| 57 | +> Changes made here apply to all development languages. Resetting options in this dialog will override individual language settings. To configure options for a specific language, select its subfolder under **Text Editor**. |
| 58 | +
|
| 59 | +## Resolve conflicting settings |
| 60 | + |
| 61 | +If you select different tab or indent settings for individual languages, Visual Studio displays a warning message: |
| 62 | +- "The indentation settings for individual text formats conflict with each other," for differing **Indenting** options. |
| 63 | +- "The tab settings for individual text formats conflict with each other," for differing **Tab** options. |
| 64 | + |
| 65 | +For example, if **Smart indenting** is set for Visual Basic and **Block indenting** for Visual C++, you’ll see a reminder about the conflict. |
| 66 | + |
| 67 | +## Configure indenting options |
| 68 | + |
| 69 | +In the **Indenting** section, choose one of the following indenting styles: |
| 70 | + |
| 71 | +- **None**: New lines are not indented; the cursor starts at the first column. |
| 72 | +- **Block**: New lines are automatically indented to match the previous line. |
| 73 | +- **Smart**: New lines are indented based on code context and IntelliSense conventions. Not available for all languages. |
| 74 | + |
| 75 | +For example, lines between braces `{ }` may be indented an extra tab stop. |
| 76 | + |
| 77 | +## Configure tab options |
| 78 | + |
| 79 | +In the **Tabs** section, choose the following options. |
| 80 | + |
| 81 | +- **Tab size**: Sets the number of spaces per tab stop (default: 4). |
| 82 | +- **Indent size**: Sets the number of spaces for each indentation (default: 4). Tabs, spaces, or both are used to fill the size. |
| 83 | +- **Insert spaces**: Indent operations insert only space characters. |
| 84 | +- **Keep tabs**: Indent operations insert as many tab characters as possible; spaces fill any remainder. |
| 85 | + |
| 86 | +## Troubleshooting |
| 87 | + |
| 88 | +> [!TIP] |
| 89 | +> Adaptive formatting may override your custom tab settings. To disable adaptive formatting, go to **Text Editor** > **Advanced** and toggle **Use adaptive formatting**. You can also use an [.editorconfig](../ide/create-portable-custom-editor-options.md) file to manage indent styles. |
| 90 | +
|
| 91 | +## Next steps |
| 92 | + |
| 93 | +- [Options, Text Editor, All Languages](../ide/reference/options-text-editor-all-languages.md) |
| 94 | +- [General, Environment, Options Dialog Box](../ide/reference/general-environment-options-dialog-box.md) |
0 commit comments