Whitespace Remover

Remove extra spaces, tabs, line breaks, empty lines and invisible characters from text in one go — and see exactly what was removed.

Text copied from PDFs, emails, websites and spreadsheets is often full of double spaces, stray tabs, broken line breaks and empty lines — and sometimes invisible characters that make searches, formulas and code fail for no visible reason. Paste it here and get clean text instantly.

Every cleaning step is an option you can switch on or off, and a report tells you exactly what was changed. The text never leaves your browser.

How to use Whitespace Remover

  1. Paste your text into “Your text”.
  2. The cleaned text appears on the right as you type.
  3. Choose what to clean: trim line ends, collapse repeated spaces, tabs to spaces, invisible characters, non-breaking spaces, empty lines — or join everything into one line.
  4. Copy the cleaned text or download it.

Features

  • Trims spaces at the start and end of every line.
  • Collapses repeated spaces into one.
  • Turns tabs into spaces.
  • Keeps, limits or removes empty lines.
  • Joins all lines into one — handy for text copied from PDFs.
  • Removes invisible characters: zero-width spaces, byte-order marks (BOM), soft hyphens and direction marks.
  • Replaces non-breaking and other special spaces with normal spaces.
  • Shows a count of everything it changed; nothing is uploaded.

Invisible characters that cause trouble

Some characters take no space on screen but still count as characters, so two words that look identical don't match, a spreadsheet formula returns an error, or code fails to compile. They often come along when copying from web pages, Word, PDFs or chat apps.

CharacterCodeCommon source
Non-breaking spaceU+00A0Web pages ( ), Word, Excel
Zero-width spaceU+200BWeb pages, chat apps, social media
Byte-order mark (BOM)U+FEFFStart of files saved by Windows tools
Soft hyphenU+00ADHyphenated text from PDFs and word processors
Zero-width joiner / non-joinerU+200D / U+200CEmoji sequences, some scripts
Left-to-right / right-to-left markU+200E / U+200FMixed-language text

Fixing text copied from a PDF

PDFs store text line by line, so copied paragraphs break at every line end and sometimes contain double spaces and soft hyphens. Tick “Join all lines into one” to turn each pasted paragraph back into one line, keep “Remove invisible characters” on to drop soft hyphens, and leave “Collapse repeated spaces” on. For many paragraphs, paste them one at a time or use “Max one in a row” for empty lines to keep paragraph breaks.

Whitespace in spreadsheets and code

Extra spaces at the start or end of a cell are the most common reason why VLOOKUP and MATCH fail to find a value. Cleaning a column here (or with Excel's TRIM function, which does not remove non-breaking spaces) fixes it. In code and data files, mixed tabs and spaces and invisible BOM characters can cause syntax errors that are hard to see — convert tabs and remove invisible characters to be sure.

Frequently asked questions

Will it change the words or punctuation in my text?

No. Only spaces, tabs, line breaks and invisible characters are touched, and only the kinds you leave switched on. Letters, numbers and punctuation stay exactly as they were.

Can I clean text for SEO titles, filenames or code?

Yes. Trimming and collapsing spaces gives clean titles and meta descriptions, and removing invisible characters prevents hard-to-find bugs in code, CSV files and spreadsheet formulas.

Is the whitespace remover free and private?

Yes. It is free and works in your browser — your text is never uploaded or stored.

How do I remove all line breaks?

Tick “Join all lines into one”. Every line break becomes a single space and empty lines disappear.

How do I remove only double spaces?

Keep “Collapse repeated spaces” on and switch the other options off. Every run of spaces becomes a single space.

What are zero-width spaces and why remove them?

They are invisible characters (U+200B) that often hide in text copied from websites and chat apps. They can break searches, passwords, spreadsheet formulas and code. “Remove invisible characters” deletes them and tells you how many were found.

Will it keep my paragraphs?

Yes, unless you join all lines. With Empty lines set to “Max one in a row”, paragraphs stay separated by a single empty line.

Why doesn't Excel's TRIM remove some spaces?

TRIM only removes the normal space character. Non-breaking spaces (common in data copied from web pages) stay. This tool turns them into normal spaces first, then trims.

Related tools