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
🌐
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
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.

Discussions

Beautify on save in VS code? - Stack Overflow
If you remove esbenp.prettier-vscode and start typing a few characters, VScode will highlight in red you have entered an invalid formatter and suggest valid values. Once you have installed Beautify, you can replace this entry with: HookyQR.beautify More on stackoverflow.com
🌐 stackoverflow.com
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
Beautifly / Tidy (Javascript) in Visual Studio Code - Stack Overflow
I'm currently giving Visual Studio Code a try. Overall I like the user experience however I can't find some of the things I'm very much used to, in sublime (with the help of extensions.) One of th... More on stackoverflow.com
🌐 stackoverflow.com
Beautify in vscode
Try prettier More on reddit.com
🌐 r/learnprogramming
1
0
December 22, 2022
🌐
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.
🌐
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
🌐
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.
🌐
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..
🌐
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.
🌐
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.
🌐
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.
🌐
Sentry
sentry.io › sentry answers › vs code › format code in visual studio code
Format code in Visual Studio Code | Sentry
Sentry helps developers monitor and fix crashes in real time. Get the details you need to resolve the most important issues quickly.
🌐
Visual Studio Code
code.visualstudio.com › docs › python › formatting
Formatting Python in VS Code
November 3, 2021 - Missed Agent Sessions Day? Watch on-demand now · 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.
🌐
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!

🌐
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