- Home
- Tools
- Text Tools
- Text Cleaner
Text Cleaner
Strip extra spaces, line breaks, HTML tags and odd characters from pasted text.
- Characters before
- 0
- Characters after
- 0
- Removed
- 0
Text copied from a PDF
A PDF stores lines, not paragraphs. Copy a paragraph out of one and every line ends in a hard line break, so the text arrives as a narrow column that refuses to reflow:
The signed forms and a copy of your pass-
port must be handed in before
Thursday.
Join the lines of each paragraph puts consecutive lines back together with a space between them. An empty line still starts a new paragraph. Remove all line breaks goes further and puts the whole text on one line.
Printed text also cuts words in two at the end of a line. Rejoin words hyphenated across lines turns "pass-" and "port" back into "passport" when the next line starts with a small letter. It cannot know that "well-" and "known" should have kept their hyphen, so it is off unless you ask for it, and worth a read-through afterwards.
Chinese and Japanese lines are joined without a space, because those languages don't put spaces between words.
Characters you can't see
Some characters take up no room on the screen and are characters all the same. A zero-width space marks a spot where a long word or link may be broken across lines. A soft hyphen does the same for a word that may be hyphenated. A no-break space looks exactly like a space and isn't one.
You notice them by their effects: a search doesn't find a word that is plainly there, a discount code or password is rejected, a program reports an unexpected character on a line that looks fine, two identical lines are not recognised as duplicates.
Remove invisible characters deletes the zero-width space (U+200B), the word joiner (U+2060), the byte order mark (U+FEFF) and the soft hyphen (U+00AD), and turns the no-break spaces (U+00A0, U+2007 and U+202F) into ordinary ones. It leaves the zero-width joiner and non-joiner alone: Persian and several Indian scripts need them for spelling, and an emoji of a family is a row of people held together by joiners.
What the other options do
| Option | Effect |
|---|---|
| Trim spaces around each line | Spaces and tabs at the start and end of every line go. |
| Collapse repeated spaces | Two or more spaces or tabs in a row become one space. A single tab stays, so tab-separated columns survive. |
| Keep one empty line at most | A run of empty lines becomes one. Lines holding only spaces count as empty. |
| Remove empty lines | No empty lines at all. |
| Straighten curly quotes and dashes | “ ” and ‘ ’ become " and ', an en dash becomes -, an em dash -- and an ellipsis three full stops. For code, CSV files and systems that only take ASCII. |
| Strip HTML tags, decode entities | Keeps the text of a piece of HTML. <b> and its relatives go, & becomes &, and paragraphs, list items and <br> become line breaks. Scripts and style sheets are dropped. |
| Remove accents | é becomes e, ñ becomes n, ø becomes o. Only Latin letters are changed, and ß and æ stay, since they are letters without an accent to take off. |
| Remove emoji | Also flags, skin tones and joined emoji. Symbols that are ordinary characters, such as © and →, stay. |
| Remove punctuation | Full stops, commas, quotes, brackets and dashes, in every script. Symbols such as $, + and = are not punctuation and stay. |
| Remove digits | 0 to 9 and the digits of other scripts. Fractions and superscripts such as ½ and ² stay. |
The options always run in the same order: HTML first, then line breaks, then single characters, and spaces last. That way the gaps left behind by removed emoji or digits are closed as well.
HTML is read by the browser's own parser into a separate document that is never displayed, so nothing in the pasted markup can run or load.