Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>WhitescrubNew to Visual Studio Code? Get it now.
Whitescrub

Whitescrub

Snehal Pancholi

| (0) | Free
Trim trailing/leading whitespace, collapse blank lines, and tidy final newlines.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Whitescrub

Tidy whitespace across the whole file — in one command.

Whitescrub cleans the most common whitespace nuisances: trailing spaces, stray leading indentation, walls of blank lines, and messy file endings. Each command rewrites the entire document, so there is nothing to select first.

Features

  • Trim Trailing Whitespace — removes spaces and tabs at the end of every line, leaving indentation untouched.
  • Trim Leading Whitespace — removes spaces and tabs at the start of every line.
  • Collapse Multiple Blank Lines — squeezes runs of two or more blank lines down to a single empty line.
  • Ensure Single Final Newline — strips trailing blank lines so the file ends with exactly one newline.
  • Scrub All — runs trim-trailing, collapse-blank, and ensure-final-newline together in one pass.

After each run, Whitescrub reports how many lines it changed.

Usage

  1. Open the file you want to clean up.
  2. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
  3. Run any Whitescrub: command.

If a command would make no difference, Whitescrub tells you there was nothing to clean up and leaves the file unchanged.

Note on line endings

Whitescrub normalises line endings to LF (\n) while it works. If your project prefers CRLF, VS Code's Files: EOL setting will re-apply it on save.

Tips

Bind Whitescrub: Scrub All to a keyboard shortcut via Preferences: Open Keyboard Shortcuts and searching for whitescrub.

License

Licensed under the MIT License. See the LICENSE file included in this extension.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft