Format Code in Visual Studio - VS Code [Mac/Windows/Linux]

In order to format code in Visual Studio Code (VS Code) you can make use of the below keyboard shortcuts depending upon which operating system you are working on,

1. Using Keyboard Shortcuts


Shift + Alt + F

Mac (macOS)

Shift + Option + F

Ubuntu (Linux)

Control + Shift + I

2. Using Menu Option

Simply right-click on your file/document and select the option "Format Document"

Format Document in VS Code

3. Using the VS Code Palette

  • Press Keys Command + Shift + P on Mac (Control + Shift + P on Windows) to open Palette.
  • Now Search for Format Document
Format Code using VS Code Palette

Happy Coding!

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap