Why isn't Word's find-and-replace of two spaces with one enough to clean my text?

Because replacing two spaces with one only fixes the simplest case. A run of four spaces needs more than one pass, a non-breaking space is invisible to a search for an ordinary space, a single space at the end of a line is not two spaces so the search skips it, and piled-up blank lines are not spaces at all. The whitespace cleaner collapses any run in one pass and handles the other cases with separate rules, each with its own counter.

Published · 3 min read

Problem one: long runs

When you replace every two spaces with one, four spaces become two after the first pass, so you need a second; eight need three. Plenty of people press 'Replace All' once, assume the text is clean, and are left with double gaps scattered around.

Worked example

The text: 'Welcome', four spaces, 'to', two spaces, 'our', three spaces, 'store'.

In the whitespace cleaner with the default rules: 3 changes, all collapsed runs of spaces, and the result is 'Welcome to our store' after a single pass.

Problem two: what the search never sees

We added to the same example a space at the end of the line, then three blank lines, then a second line, 'Free shipping', with a non-breaking space copied from a web page between the words.

Worked example

The default rules make 7 changes: one special space replaced, the end of one line trimmed, 3 runs of spaces collapsed and two blank lines removed.

The result: 'Welcome to our store', one blank line, then 'Free shipping' with a normal space.

Of those seven changes, a double-space search in Word catches only the runs of spaces, and only after several passes. The single trailing space is not two spaces, the non-breaking space is a different character, and blank lines are line breaks, not spaces.

Steps

  1. Copy the text from Word and paste it into the Whitespace cleaner.
  2. Keep the default rules and look at the counter beside each rule to see what it found.
  3. If the text came from a table, turn on tab conversion. If it came from a website, consider the zero-width rule.
  4. Copy the result and paste it back into Word or your store.

When Word is enough

For a short text you typed yourself, with a double space here and there, Word's find and replace does the job, especially if you repeat it until it finds nothing. The cleaner is worth the extra step when the text was copied from a PDF, a website or a spreadsheet, or when you want to know exactly what will change before it does.

What Word does that the cleaner does not

  • The cleaner works on plain text, so formatting such as bold and headings does not pass through it. Clean the text, then format it, or clean only the parts that need it.
  • The cleaner does not replace words or punctuation. To find and replace a word, use Word.
  • The cleaner never changes a single space between words.

Common questions

Does the cleaner remove a space before punctuation?

No, it knows nothing about punctuation rules. A single space before a comma stays as it is.

Does it handle mixed Arabic and English text?

Yes, the rules work on spaces regardless of the language of the words.

Is my text sent to a server?

No, cleaning runs inside your browser.