- Instant help with your Developer coding problems

Remove trailing spaces in VS Code

How to remove trailing spaces in VS Code?

// OR

"files.trimTrailingWhitespace": true

If you want to keep your code clean and therefore remove trailing white space characters, you can choose from the following solutions in VS Code.

Solution 1

Use the keyboard shortcut CTRL + K CTRL + X to remove trailing blank spaces from the current file.

You can also access this effect by pressing F1 and typing 'Trim Trailing Whitespace' and pressing Enter .

Solution 2

If you want to delete white space characters not just every now and then, but automatically every time you save, use the Settings panel. File -> Preferences -> Settings and in the search field type Trim Trailing Whitespace' and check the option.


Share "How to remove trailing spaces in VS Code?"