Share via


Configure indent and tab settings in Visual Studio

Learn how to change the default tab and indentation behavior for the Code Editor in Visual Studio by using the text editor configuration options.

Access options for indents and tabs

Resolve conflicting settings

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.

Configure indenting options

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 tab options

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.

Troubleshooting

Next steps