Formula
characters removed = characters before − characters after
- Repeated spaces and tabs become a single space
- Zero-width characters (U+200B–U+200D, U+2060, U+FEFF) are deleted
Each cleaning step is applied in turn, and the difference in length is reported.
Worked examples
Tidy a pasted paragraph
- Your text
- This text has extra spaces. It also has blank lines and a stray tab.
- Collapse repeated spaces and tabs into one
- Yes
- Trim spaces at the start and end of every line
- Yes
- Blank lines
- Allow at most one blank line in a row
- Turn non-breaking and special spaces into normal spaces
- Yes
- Remove invisible zero-width characters
- Yes
- Join all lines into one paragraph
- No
Characters removed
16
Characters before: 85
Characters after: 69
Lines after: 3
This text has extra spaces. It also has blank lines and a stray tab.
Un-wrap text copied from a PDF
- Your text
- Lines copied from a PDF are broken in the middle of every sentence.
- Collapse repeated spaces and tabs into one
- Yes
- Trim spaces at the start and end of every line
- Yes
- Blank lines
- Remove all blank lines
- Turn non-breaking and special spaces into normal spaces
- Yes
- Remove invisible zero-width characters
- Yes
- Join all lines into one paragraph
- Yes
Characters removed
0
Characters before: 67
Characters after: 67
Lines after: 1
Lines copied from a PDF are broken in the middle of every sentence.
How it works
Text copied from PDFs, web pages, emails and chat apps often carries more whitespace than you can see: double spaces after full stops, tabs, blank lines between every paragraph, non-breaking spaces that look like normal ones and zero-width characters that are completely invisible. Each option here targets one of those, and you can combine them. The summary shows how many characters were removed, which is a quick way to confirm that something invisible was there.
Collapsing turns any run of spaces and tabs into a single space; trimming removes spaces at both ends of every line. Blank lines can be kept, limited to one in a row, or removed entirely. Joining lines turns a hard-wrapped block of text (for example, copied from a PDF) into one flowing paragraph by replacing each line break with a space. Line endings are normalised, so text from Windows and Mac behaves the same.
Line breaks inside quotes or code are treated like any other, so do not use joining on code or poetry. For counting what remains use the Word Counter, for changing particular words use Find and Replace Text, for removing repeated lines use Remove Duplicate Lines, and for changing capitalisation use the Case Converter.
Assumptions and limits
- Only spaces, tabs, line breaks and the listed invisible characters are changed; words and punctuation are untouched.
- Joining lines also removes blank lines, because they would otherwise become extra spaces.
- Text above about 2 million characters is not accepted.