Text Tools
Remove Extra Spaces and Whitespace
Remove extra spaces, tabs and blank lines from text, convert non-breaking and full-width spaces, and strip invisible zero-width characters and BOMs.
How to use Remove Extra Spaces and Whitespace
Paste the messy text and the cleaned version appears as you type. Each rule can be switched on or off: collapse spaces, trim line ends, collapse or remove blank lines, normalise special spaces and delete zero-width characters.
- Paste the textPaste text copied from a web page, PDF, email or spreadsheet export.
- Pick the clean-up rulesCollapse spaces and tabs, trim both ends or only trailing spaces, and collapse or remove blank lines.
- Copy the clean textThe note shows how many characters, special spaces and blank lines were removed; then press Copy result.
What gets cleaned
Runs of two or more spaces or tabs become a single space, and spaces at the start and end of each line are trimmed (or only the trailing ones, if you want to keep indents). Runs of blank lines collapse to one or are removed entirely, and blank lines at the very start and end of the text are always dropped. Non-breaking spaces, the narrow no-break space, en and em spaces and the full-width ideographic space become ordinary spaces. Zero-width spaces, the word joiner, soft hyphens and the byte order mark (BOM) are deleted, while the zero-width joiners that hold emoji and Persian or Indic text together are kept. On the sample text this removes 15 characters, including one zero-width space and two special spaces.
Why invisible characters cause problems
Text copied from websites, Word documents and PDFs often carries characters you cannot see. A non-breaking space looks like a normal space but stops find and replace, spreadsheet lookups and duplicate checks from matching; a zero-width space can break a password, URL or product code; and a BOM at the start of a CSV file can spoil the first column name. Tick Remove spaces between Chinese characters for PDF text where every Chinese character is followed by a space; it only removes spaces between Chinese characters and full-width punctuation, so spacing around English words is untouched.
Accuracy and data handling
Before copying the output, check names, punctuation and the intended meaning against the source text. The calculation runs in your current browser; the tool code does not send the input to a processing API.
FAQ
How do I remove double spaces from text?
Paste the text with Collapse runs of spaces and tabs ticked. Every run of two or more spaces or tabs becomes one space, and spaces at line ends are trimmed too.
Can it remove non-breaking spaces?
Yes. With Turn full-width and non-breaking spaces into normal spaces ticked, NBSP (U+00A0), the narrow no-break space and the full-width space U+3000 become ordinary spaces.
What is a zero-width space?
An invisible character (U+200B) used as a line-break hint. It is easy to paste by accident and breaks searches and codes. The zero-width option deletes it, along with word joiners, soft hyphens and the BOM.
Is anything removed that I might want to keep?
Zero-width joiners (ZWJ and ZWNJ) are kept by default, because combined emoji such as the family emoji and Persian or Indic words need them, and the note says how many were kept. Tick Also remove zero-width joiners only if they are stray.
More Text Tools
Related toolsSort a list A to Z, naturally, by number or by length.
Delete blank lines or squeeze runs of them down to one.
Bulk-convert phone numbers to E.164, international or national format.
Rank the most frequent words and phrases with counts and shares.
Count sentences, measure average length and flag long sentences.
Count paragraphs and see the average and longest paragraph length.