The code formatting is available in Visual Studio Code through the following shortcuts:

  • On Windows Shift + Alt + F
  • On Mac Shift + Option + F
  • On Linux Ctrl + Shift + I

Alternatively, you can find the shortcut, as well as other shortcuts, through the submenu View / Command Palette, also provided in the editor with Ctrl + Shift + P (or Command + Shift + P on Mac), and then searching for format document.

For unsaved snippets

  1. Open command palette (Win: F1 or Ctrl + Shift + P)

  2. Find "Change Language Mode"

  3. Select language e.g. json. By now, the syntax should be highlighted.

  4. Format document (e.g. Open Command Palette -> "Format Document")

Unformat

  1. Select text
  2. Command Palette -> Join Lines

'Show the pics'

Answer from npc2b on Stack Overflow
Top answer
1 of 16
6008

The code formatting is available in Visual Studio Code through the following shortcuts:

  • On Windows Shift + Alt + F
  • On Mac Shift + Option + F
  • On Linux Ctrl + Shift + I

Alternatively, you can find the shortcut, as well as other shortcuts, through the submenu View / Command Palette, also provided in the editor with Ctrl + Shift + P (or Command + Shift + P on Mac), and then searching for format document.

For unsaved snippets

  1. Open command palette (Win: F1 or Ctrl + Shift + P)

  2. Find "Change Language Mode"

  3. Select language e.g. json. By now, the syntax should be highlighted.

  4. Format document (e.g. Open Command Palette -> "Format Document")

Unformat

  1. Select text
  2. Command Palette -> Join Lines

'Show the pics'

2 of 16
607

Code Formatting Shortcut:

Visual Studio Code on Windows - Shift + Alt + F

Visual Studio Code on MacOS - Shift + Option + F

Visual Studio Code on Ubuntu - Ctrl + Shift + I

You can also customize this shortcut using a preference setting if needed.

Code Formatting While Saving the File:

Visual Studio Code allows the user to customize the default settings.

If you want to auto format your content while saving, add the below code snippet in the work space settings of Visual Studio Code.

Menu FilePreferencesWorkspace Settings

{
  // Controls if the editor should automatically format the line after typing
  "beautify.onSave": true,

  "editor.formatOnSave": true,

  // You can auto format any files based on the file extensions type.
  "beautify.JSfiles": [
      "js",
      "json",
      "jsbeautifyrc",
      "jshintrc",
      "ts"
  ]
}

Note: now you can auto format TypeScript files. Check my update.

🌐
Visual Studio Code
code.visualstudio.com › docs › editing › codebasics
Basic editing
November 3, 2021 - Learn about the basic editing features of Visual Studio Code. Search, multiple selection, code formatting.
Discussions

Best formatter/beautify extension you know of that supports largest selection of languages?
I wouldn't rely on that - better just find the best for each you have to use (and I doubt that you have to deal with 100 different languages on a daily basis). I'm dealing mostly with frontend web and I have to say Prettier is, well, pretty good once you set it up to your liking. More on reddit.com
🌐 r/vscode
5
15
November 25, 2021
Beautify in vscode
Try prettier More on reddit.com
🌐 r/learnprogramming
1
0
December 22, 2022
Beautify 1.5.0 format on save not working with vscode 1.50.1
VSCode Version: 1.50.1 OS Version: Ubuntu 20.04.1 Steps to Reproduce: Install vscode 1.49.3 with beautify extension verify format on save is working upgrade vscode to 1.50.1 (no changes on extensio... More on github.com
🌐 github.com
4
September 6, 2020
What's your approach to auto-formatting your project in VS Code?
Prettier plugin: DO NOT change any of the settings and setup a .prettierrc in your project. Set Prettier as your formatter and format on save. And then thankfully forget about formatting ever again, for you and your team. EDIT: Set your formatter with "Format document with..." > "Configure Default Formatter" More on reddit.com
🌐 r/react
13
2
March 17, 2023
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Beautify - Visual Studio Marketplace
May 2, 2019 - Extension for Visual Studio Code - Beautify code in place for VS Code
🌐
Medium
medium.com › nybles › how-to-beautify-vs-code-e5c74f7144bc
How to beautify VS Code. Well this arc begins like it did for… | by Shailesh Tiwari | Nybles | Medium
December 11, 2021 - I was on YouTube trying get hold of some React.js hacks and suddenly come across this video with one of the prettiest VS Code setups I’d ever seen; and I was hooked. Gone was the thought of finishing the project I had come seeking aid for, I needed my VS code looking beautiful and wouldn't rest till it did.
Find elsewhere
🌐
Medium
medium.com › @pabloargueta27 › how-to-beautify-your-vscode-56d397fa50d7
How to beautify your VSCode!. Being an Atom user I kept hearing that… | by Pablo Argueta | Medium
August 2, 2018 - The following are awesome steps that can help you set up and personalize VSCode to your liking using such tools like developer tools.
🌐
ServiceNow Community
servicenow.com › community › developer-forum › beautify-is-deprecated-when-do-we-get-a-new-version › m-p › 1860978
Beautify is deprecated .. when do we get a new ver... - ServiceNow Community
September 1, 2022 - Yes, it looks like Beautify is not supported anymore by the developers who built it. I think I was reading that VS Code introduced native color coding brackets and a couple other features last year that put the native stuff on par with it.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Prettier - Code formatter - Visual Studio Marketplace
January 21, 2026 - Extension for Visual Studio Code - Code formatter using prettier
🌐
Hashnode
pranavsarda.hashnode.dev › beautify-visual-studio-code-with-custom-setup
Beautify 'Visual Studio Code' with custom setup - Pranav Sarda
June 30, 2021 - Now open your VSCode, Click on View>Command palette and type Preferences: Open settings..
🌐
Bretcameron
bretcameron.com › blog › a-guide-to-beautifying-visual-studio-code
A Guide to Beautifying Visual Studio Code | Bret Cameron
April 1, 2019 - In my previous article on VS Code, I wrote about both ESLint and Prettier, with a focus on their more practical functionality. ESLint is primarily a linter (helping you spot errors) and Prettier is mainly a formatting tool, but there’s some crossover in terms of what they do. Finally, Beautify is another formatting tool, but it covers a few circumstances that Prettier doesn’t.
🌐
Reddit
reddit.com › r/learnprogramming › beautify in vscode
r/learnprogramming on Reddit: Beautify in vscode
December 22, 2022 -

Hi folks, I’m very new and learning how vscode works. Can you point me to an extension that will do a beautify function, like I’ve see Atom do?

Thank you!

🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-format-code-with-prettier-in-visual-studio-code
Format Code with Prettier in Visual Studio Code: Setup Guide | DigitalOcean
August 1, 2025 - Note: If you do not see a prompt for selecting a default formatter, you can manually set Prettier as the default formatter in VS Code. Open your Settings and set Editor: Default Formatter to esbenp.prettier-vscode.
🌐
Visual Studio Marketplace
marketplace.visualstudio.com › items
Pretty Formatter - Visual Studio Marketplace
Extension for Visual Studio Code - VS Code extension to format your code using Pretty Diff
🌐
Visual Studio Code
code.visualstudio.com › docs › python › formatting
Formatting Python in VS Code
November 3, 2021 - VS Code February events – Agent Sessions Day on Feb 19th · Formatting makes source code easier to read by human beings. By enforcing particular rules and conventions such as line spacing, indents, and spacing around operators, the code becomes more visually organized and comprehensible.
🌐
GitHub
github.com › microsoft › vscode › issues › 108878
Beautify 1.5.0 format on save not working with vscode 1.50.1 · Issue #108878 · microsoft/vscode
September 6, 2020 - VSCode Version: 1.50.1 OS Version: Ubuntu 20.04.1 Steps to Reproduce: Install vscode 1.49.3 with beautify extension verify format on save is working upgrade vscode to 1.50.1 (no changes on extensio...
Author   ledmirage
🌐
Visual Studio Code
code.visualstudio.com › docs › csharp › formatting-linting
Formatting and Linting
November 3, 2021 - Formatting and linting C# source code in Visual Studio Code