VS Code: How To Change Indentation (2 spaces, 4 spaces)

Updated: September 1, 2023 By: A Goodman 2 comments

This short and straight-to-the-point article shows you how to change the indentation in VS Code (Visual Studio Code).

1. Open your VS Code and:

  • Go to Code > Settings (or Preferences) > Settings if you’re using macOS (shortcut: Command + ,).
  • Go to File > Preferences > Settings if you’re using Windows (hotkey: Ctrl + ,).

Here’s the screenshot on Mac:

2. Type “Indentation” into the search field then head to the “Editor: Tab Size” section. Replace the default space number with your preferred one:

Your setting will be applied and reflected immediately. If this doesn’t happen (it’s a little lag sometimes), just reload or restart your VS Code.

Further reading:

You can also check out our Visual Studio Code topic page for more tips and tricks to improve your producibility and coding experience. Happy coding!

Inline Feedbacks
View all comments
10 months ago


3 years ago

Thanks, it was very helpful!

Related Articles