Text

Whitespace and Line Break Cleaner

Find and remove hidden characters, non-breaking spaces and stray line breaks β€” without breaking non-Latin text.

Runs entirely in your browser. Nothing you paste is uploaded.

0 characters Β· 0 bytes

This runs entirely in your browser. Nothing you paste is sent to us or to anyone else.

How to use it

  1. Paste your text into the box marked "Your text"Paste text that has come from a PDF, a web page, an email or anywhere else that leaves a mess behind. Everything happens inside your browser β€” nothing is uploaded, so there is nothing for us to store, log or lose.
  2. Read the result as it updatesThere is no button to press. Turn on the cleanups you want and the result updates immediately. The output recomputes every time you change the text or one of the options above it.
  3. Start with invisible charactersZero-width spaces and byte-order marks are the ones that cause inexplicable bugs β€” a string comparison fails, a search finds nothing, and nothing looks wrong on screen because they are invisible by definition.
  4. Normalise unusual spacesNon-breaking spaces and other exotic space characters come in from word processors and look identical to ordinary spaces. They are not, and anything splitting on whitespace will disagree with your eyes.
  5. Choose your line endings deliberatelyWindows uses CRLF and everything else uses LF. Mixed endings in one file are what turn a one-line change into a diff that touches every line.
  6. Use trimming and collapsing lastTrim each line, trim the whole text and collapse repeated spaces are independent. Read the notes: they say exactly what was changed and how much of it, so a cleanup is never silent.
  7. Copy or download the resultThe buttons under the output put it on your clipboard or save it as a file, and each one says exactly what it will copy or download. Any note about something the tool changed or deliberately left alone is shown with the result rather than hidden.

About this tool

Finds and removes the whitespace problems that come with text copied out of a PDF, a spreadsheet, a word processor or a web page: trailing spaces, runs of blank lines, tabs, mixed line endings, and characters that are genuinely invisible.

The panel showing what your text *contains* is half the tool. "Why do these two strings not match when they look identical?" is usually answered by "one of them has four non-breaking spaces in it", and seeing that is more useful than cleaning it.

Understanding the result

A non-breaking space looks exactly like an ordinary space and is a different character. It will not match a search, will not split a word, and will not compare equal β€” which is why it breaks imports and lookups so often.

Zero-width spaces, byte-order marks and soft hyphens are invisible and inert. They are removed, and the count of each is reported, because a tool that deletes characters you cannot see must say what it deleted.

Line endings are normalised before anything else and restored at the end. Trimming CRLF text without doing that leaves an invisible carriage return at the end of every line.

Example

Input

Roftr[non-breaking space]Clouds[zero-width space]␣␣␣

Output

Roftr Clouds
β–² 1 Γ— non-breaking space Β· 1 Γ— zero-width space Β· 1 line with trailing whitespace

Limitations

  • Zero-width joiners and non-joiners are never removed. They are invisible but not meaningless: they control letter joining in Tamil, Devanagari, Persian and Arabic, and they are what holds a multi-part emoji together. Removing them changes the text. The same applies to the marks that lay out Arabic and Hebrew.
  • Collapsing repeated spaces will flatten deliberate alignment β€” in an ASCII table or in code. Keep indentation, or leave the option off, when that matters.
  • Converting spaces to tabs applies to indentation only. Spaces used to align text inside a line are left alone, because converting those breaks the alignment.
  • This works on whitespace and invisible characters. It will not fix encoding damage, where the bytes were already misread and the characters are visibly wrong.

Questions

Is my text uploaded anywhere?

No. The whole tool is JavaScript running on your device β€” there is no request to send. You can confirm it by opening your browser's network tab, or by disconnecting from the internet and using the page anyway.

Why does my text have hidden characters at all?

Copying from a PDF brings soft hyphens and figure spaces. Word processors insert non-breaking spaces to keep things on one line. Web pages carry zero-width spaces used as line-break hints. A file saved by a Windows editor may start with a byte-order mark.

Why does it refuse to remove some invisible characters?

Because removing them would change the text. In Tamil, Devanagari, Persian and Arabic a zero-width joiner or non-joiner decides how the letters connect, and in emoji it is what makes one glyph out of several. A tool that strips everything invisible corrupts exactly the text a reader of English cannot check.

Will this break my code indentation?

Not with the default settings. Trailing whitespace goes, indentation stays. Turning on "collapse repeated spaces" without "keep indentation" is the one combination that will flatten it.

Last updated 2026-08-16.

Related tools