textscrubr
Home / Blog / Punctuation

How to Remove Double Spaces From Text Fast

Punctuation2 min readUpdated 2026-06-23
To remove double spaces, paste your text into a cleaner that collapses every run of two or more spaces into one. In an editor, use find-and-replace to swap two spaces for one and repeat until none remain. A cleaner also trims trailing spaces and leaves indentation intact.

Double spaces sneak into text from old typing habits, pasted content, and AI output. Here is how to remove them without creating new problems.

The quick way: a cleaner

Paste your text into a tool that collapses spacing and every run of multiple spaces becomes a single space at once. The advantage over manual find-and-replace is that a structure-aware cleaner:

textscrubr does this while also stripping the invisible characters and non-breaking spaces that often cause the odd gaps in the first place.

Find and replace

In any editor:

  1. Open find-and-replace.
  2. Search for two spaces ().
  3. Replace with one space ().
  4. Run it more than once, because three spaces become one space plus one extra, and you want to catch the leftovers. Repeat until it finds nothing.

If your editor supports regular expressions, search for {2,} and replace with a single space to catch every run at once.

Watch out for indentation and code

Blunt space-collapsing is dangerous in two places:

This is why a structure-aware cleaner is safer than a global find-and-replace: it knows to leave leading indentation and code spacing alone and only collapses the runs inside ordinary prose.

Where double spaces hide

The classic case is two spaces after a period, a holdover from typewriters. But they also appear from pasted web content, merged text, and non-breaking spaces masquerading as regular ones. Normalizing odd spaces first, then collapsing the runs, clears all of it.

Scrub this text in one click

textscrubr strips the hidden characters, em dashes, and double spaces, and keeps your lists, headings, and code exactly where you put them. Free, and it runs entirely in your browser.

Clean my text free →

Frequently asked questions

How do I remove all double spaces at once?

Paste the text into a cleaner that collapses runs of spaces, or use find-and-replace to swap two spaces for one and repeat until none remain. Regex ` {2,}` catches every run in one pass.

Will removing double spaces break my code indentation?

It can with a blunt tool. A structure-aware cleaner leaves leading indentation and code spacing alone and only collapses runs inside ordinary prose.

Why does my text have double spaces I did not type?

Often from pasted content or from non-breaking and exotic spaces that look like normal spaces. Normalizing those first, then collapsing runs, removes them.