Skip to content
TypeParser
All tools

Whitespace Cleaner

Strip extra whitespace.

beats browserling.com edge: Multi-mode whitespace cleanup
input
Guide

About Whitespace Cleaner

Strip extra whitespace from any text. Trim each line, collapse consecutive spaces or blank lines, normalize tabs/spaces, remove zero-width characters. Useful when text comes back from a system that mangled the spacing — copy from PDF, paste from Word, output from a code generator.

Why whitespace bugs are sneaky

Whitespace is invisible but semantically loaded. Trailing spaces in a config break some parsers. Mixed tabs/spaces break Python. Zero-width characters confuse search. Two consecutive spaces look like one but compare unequal.

This tool surfaces those issues and cleans them in one pass.

Cleaning options

  • Trim trailing whitespace per line (the most common cleanup)
  • Trim leading whitespace per line (off by default — preserves indent)
  • Collapse multiple spaces to one
  • Collapse multiple blank lines to one (or remove all blanks)
  • Tabs → N spaces with configurable width
  • Spaces → tabs for languages that prefer tabs
  • Strip zero-width chars (ZWSP, ZWNJ, ZWJ, BOM)
  • Strip non-breaking spaces (U+00A0) → regular space

Common workflows

Clean a PDF copy-paste. PDF text comes with weird character widths and zero-widths. Run through, get clean ASCII.

Normalize a config file. A teammate’s editor saved tabs; your linter wants spaces. Convert.

Fix a hidden ZWSP. A search returns no matches even though the string is visibly there. Strip zero-widths to normalize.

Prepare for diff. Two configs that look identical but diff dirty. Strip whitespace from both, diff again, see real changes.

Frequently asked questions

What gets cleaned?
Trailing whitespace per line, leading whitespace per line (toggle), runs of spaces/tabs, runs of blank lines, zero-width characters, BOM markers — all toggleable.
Tabs vs spaces?
Toggle. Convert all tabs to N spaces, or all leading spaces to tabs (with configurable tab width).
Zero-width characters?
ZWSP (U+200B), ZWNJ (U+200C), ZWJ (U+200D) — invisible chars that break searches and collapsing. Toggle to strip them.
Will my code blocks lose indentation?
Toggle off "leading whitespace" trimming if you need to preserve indentation. The default trims trailing only.
BOM removal?
U+FEFF at the start of file — added by some editors, breaks parsers. Toggle to strip.
Newline conversion?
Different tool — use Line Endings for CRLF/LF/CR conversion specifically.

Related tools

Last updated: 2025-01-15