Double spaces get into text from everywhere. People who learned to type on a typewriter still tap the spacebar twice after a full stop, PDF extractors pad lines with runs of spaces to imitate columns, and copying out of a spreadsheet or a web table drags tabs along with it. None of this is visible at a glance, but it shows up the moment the text lands somewhere fussy: a CSV import that rejects a name with a trailing space, a form that counts every space against your limit, a layout where one line is oddly wider than the rest.
Paste the text into the box above and the cleaned version appears on the right. The default settings turn every run of spaces into one space and trim the start and end of each line, which is what you want about nine times out of ten.
What counts as a space
Ordinary spaces, tabs (unless you untick “Treat tabs as spaces”) and non-breaking spaces. The last one matters more than you would expect. Word and most web pages use non-breaking spaces, character 160, to stop a phrase like “10 km” splitting across two lines. They look identical to normal spaces, but a find-and-replace for a plain space walks straight past them. This tool catches them too.
Line breaks are never touched. If the trouble is lines that break in the wrong place, you want remove line breaks. If you have stacks of blank lines as well, remove empty lines deals with those.
Collapse, or remove everything?
“Collapse repeats to one” is the right choice for normal writing. “Remove all spaces” does what it says and glues everything together, so “hello big world” becomes “hellobigworld”. That’s useless for sentences but handy for numbers someone typed with gaps in them. 4111 1111 1111 1111 becomes 4111111111111111, and a serial code copied from a label stops being three separate words.
The catch: indentation
Leading spaces are runs of spaces like any other, so collapsing and trimming will flatten indentation. That is fine for an email or an article and ruinous for code, YAML, or anything where structure lives in the indent. If all you want is to swap tabs for spaces in code, use tabs to spaces and leave this tool alone. The same goes for poems and addresses where you indented a line on purpose. Run it on a copy.
Where it earns its keep
Tidying a paragraph before it goes into a CMS, where double spaces after periods get collapsed on screen but stay in the database. Cleaning a list of names or product codes before a duplicate check, because “Smith “ and “Smith” are different lines until the trailing space is gone. Getting text down to size for a platform that counts spaces as characters; the character counter will show you the before and after.
The “Characters removed” figure under the result tells you how much was in there. If it says zero and the text still looks gappy, the culprit is something else, usually line breaks or invisible characters, and the invisible character page explains the usual suspects.