Text Transform

Whitespace remover

What to do

Transformed in your browser · nothing is uploaded

Local · non-breaking spaces included
Advertisement
320 × 100

Two different jobs: collapsing runs of spaces to one and trimming each line, or removing every space, tab and line break so the text becomes a single unbroken string.

How to use the whitespace remover

1 Paste your text into the first box.
2 Choose what you want done to it.
3 Copy the result, or save it as a text file.

Collapsing is what you want for prose: double spaces after full stops, trailing spaces at line ends, stray tabs from a paste. Removing everything is for data: a card number, a hash or a key that has picked up spaces from being wrapped across lines. Both matter more than they look, because trailing whitespace is invisible and is a common cause of a comparison failing when two values appear identical. Non-breaking spaces are worth a special mention: they are not matched by a plain space search, so a find-and-replace on " " leaves them behind. Both options here treat them as whitespace.

Questions

Collapse leaves single spaces between words. Remove all produces one unbroken string with no spaces at all.

MDN, working with strings
Advertisement
300 × 250
Was this tool any good?
Internal signal only · I use it to find the tools worth rebuilding