---
title: "How to change indentation in Visual Studio Code?"  
description: "How to change indentation in Visual Studio Code?"  
author: "Steilla Mitchel"  
published: 2023-07-19  
updated: 2023-07-19  
canonical: https://www.mindstick.com/forum/159162/how-to-change-indentation-in-visual-studio-code  
category: "visual studio"  
tags: ["visual studio", "format"]  
reading_time: 2 minutes  

---

# How to change indentation in Visual Studio Code?

How to change indentation in [Visual Studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) [Code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii)?

## Replies

### Reply by Aryan Kumar

There are a few ways to change indentation in [Visual](https://yourviews.mindstick.com/audio/1147/through-the-lens-a-visual-exploration-of-the-world) [Studio Code](https://www.mindstick.com/forum/159438/how-to-connect-tfs-in-visual-studio-code).

## 1. Using the keyboard shortcuts

- To indent a line of code one level, press **Ctrl + ]**.
- To unindent a line of code one level, press **Ctrl + [**.
- To indent multiple lines of code, select the lines of code and then press **Ctrl + ]** or **Ctrl + [**.

## 2. Using the Command Palette

- To open the Command Palette, press **Ctrl + Shift + P**.
- Type "indent" and then select the "Indent Lines" command.
- In the dialog box that appears, select the number of spaces you want to indent the lines by.

## 3. Changing the settings

You can also change the default indentation settings in Visual Studio Code. To do this, open the Settings editor by pressing **Ctrl + ,**. In the settings editor, search for the "editor.tabSize" and "editor.insertSpaces" settings. The "editor.tabSize" setting controls the number of spaces that are inserted when you press the Tab key. The "editor.insertSpaces" setting controls whether Visual Studio Code should insert spaces or tabs when you indent code.

For example, to change the indentation to 4 spaces, you would set the "editor.tabSize" setting to 4. To change Visual Studio Code to use spaces instead of tabs, you would set the "editor.insertSpaces" setting to true.

Here are the steps on how to change the indentation in Visual Studio Code using the settings:

1. Open the Visual Studio Code app.
2. Open the code file you want to change the indentation for.
3. Press **Ctrl + ,** to open the Settings editor.
4. In the Settings editor, search for the "editor.tabSize" setting.
5. In the "editor.tabSize" setting, enter the number of spaces you want to use for indentation.
6. Save your changes.

Once you have saved your changes, the indentation in your code file will be changed to the number of spaces you specified.


---

Original Source: https://www.mindstick.com/forum/159162/how-to-change-indentation-in-visual-studio-code

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
