Whitespace Remover
Clean up messy spacing: collapse double spaces, strip tabs, trim line edges and remove the invisible non-breaking spaces that sneak in when you paste from the web.
Your text is processed locally in your browser and is not uploaded to our servers.
Cleaned text
0 charactersSummary
What this tool does
Text that has been copied and pasted a few times collects spacing damage: double spaces where there should be one, tabs mixed with spaces, ragged indentation, and — worst of all — non-breaking spaces that look identical to normal spaces but behave differently and break search and layout. This tool fixes all of that in one pass, with each fix under your control.
How to use it
- Paste the text with the spacing problem.
- Leave the default options on for the usual cleanup: trim edges, tidy line edges, collapse repeated spaces and normalize non-breaking spaces.
- Turn on more aggressive options — remove tabs, remove line breaks, or remove all whitespace — only when you need them.
- Copy the cleaned result.
What each option does
- Trim the text removes whitespace from the very start and end of the whole block.
- Trim every line removes leading and trailing spaces and tabs from each line, which fixes ragged indentation without touching the line breaks.
- Collapse repeated spaces turns any run of two or more spaces into a single space, but leaves line breaks alone.
- Replace tabs converts tab characters to a single space so mixed tabs and spaces become consistent.
- Convert non-breaking spaces replaces U+00A0 and its relatives with ordinary spaces. This is the fix for text that looks fine but will not wrap or search correctly.
- Remove zero-width characters strips invisible characters such as zero-width spaces and the byte-order mark, which sometimes hide inside pasted text and cause mysterious bugs.
- Remove line breaks joins everything onto one line, replacing each break with a space.
- Remove every space deletes all whitespace of any kind, useful for turning a spaced-out string into a single token.
The options are applied in a sensible order so they cooperate: non-breaking spaces are normalized before spaces are collapsed, for example, so a run that mixes both is still reduced to one space. The Remove every space option is the most aggressive and effectively overrides the gentler ones.
Examples
Text copied from a formatted web page often looks like this (the · marks show hidden characters):
··The·quick···brown·fox··
····jumps·over·the·lazy·dog.··
With the default options, the result is a clean:
The quick brown fox
jumps over the lazy dog.
A common real fix: a price like 1 000 € that will not sort or search because the space is a non-breaking space. Turning on Convert non-breaking spaces makes it a normal 1 000 € that behaves.
Common use cases
- Cleaning pasted content before it goes into a CMS or document.
- Fixing data where non-breaking spaces prevent sorting or matching.
- Normalizing indentation in text pulled out of a PDF.
- Preparing text for a single-line field by removing line breaks.
- Removing invisible characters that cause unexplained comparison failures in spreadsheets and code.
Privacy and security
Cleaning happens in your browser. Nothing is uploaded, so pasted documents and data stay on your device. Your option choices are remembered locally. See the privacy policy.
Frequently asked questions
What is a non-breaking space and why does it cause problems?
A non-breaking space (U+00A0) looks exactly like a normal space but tells the layout not to break the line there. It arrives when you copy from many web pages and PDFs. Because it is a different character, a search for a normal space will not match it, and sorting can put values in the wrong order. Converting it to a normal space fixes both.
Will it remove spaces inside my words?
No. Collapsing spaces only affects runs of two or more spaces between words. Single spaces are kept, and letters are never touched — unless you deliberately turn on Remove every space.
What are zero-width characters?
They are invisible characters such as the zero-width space, zero-width joiner and byte-order mark. They take up no visible room but can break string comparisons, URLs and code. The optional remover strips them out.
How do I turn a paragraph into a single line?
Turn on Remove line breaks. Each break becomes a space, so the paragraph flows onto one line. For more control over what replaces the breaks — commas, for instance — use the Line Break Remover.
Does it change line breaks between paragraphs?
Only if you ask it to. The trimming and collapsing options preserve line breaks; the paragraph structure is kept unless you enable Remove line breaks or Remove every space.
Related tools
Tools that pair well with the Whitespace Remover.