Paste Text Cleaner
Text copied from a PDF, Word, Slack or a web page often carries characters you cannot see. This tool removes zero-width spaces, byte order marks, soft hyphens and bidirectional embeddings. Joiners and direction marks stay where emoji or right-to-left and Indic text need them. With Trim extra spaces on, it collapses runs of spaces and tabs inside a line, trims line ends, keeps indentation, turns non-breaking spaces into normal ones, and, in plain text, caps blank lines at one. With Input is HTML ticked, the line breaks and tabs come from the markup and are kept, so empty table cells and rows stay while Preserve line breaks is on.
How to clean pasted text
- Paste the text into Paste your text. The box starts with a sample that has hidden characters in it.
- Choose Plain Text or Markdown under Output format.
- Under Options, untick Preserve line breaks to turn the text into one line, or untick Join words hyphenated across lines to keep line-end hyphens.
- If the text is HTML source, tick Input is HTML. Pasting text that contains HTML tags shows a hint but does not tick it for you, so prose with angle brackets is never changed by accident.
- Click Clean Text. Cleaned output fills in, with how many characters were removed or added.
- Click Copy Result to put the cleaned text on your clipboard.
What invisible characters do to pasted text
A zero-width space (U+200B), a byte order mark (U+FEFF) and the bidirectional controls (U+202A to U+202E, U+2066 to U+2069) take up no visible room but still count as characters. They make two strings that look identical compare as different, break searches and word counts, and can turn a pasted variable name into a syntax error. A soft hyphen (U+00AD) is meant to show only where a line wraps, so it shows up as a stray hyphen after copying from a PDF.
The zero-width joiner (U+200D) holds emoji sequences together, such as family emoji, and the joiner and non-joiner (U+200C) control letter shaping in Persian and Devanagari. So they are kept between emoji parts and between letters or marks of Arabic, Indic, Khmer and a few other scripts, and removed everywhere else, such as inside Latin words. The marks U+200E, U+200F and U+061C are kept only when the text has Hebrew, Arabic or similar letters. Tick Remove zero-width joiners (splits emoji) to delete all joiners.
A PDF breaks lines inside words. A letter, a hyphen, one line break and a lowercase letter become one word, so hyphen- and ated join, but Anglo- and Saxon do not. A real compound split at a line end, such as well-known, loses its hyphen, so untick the option for that text. HTML input is never joined, because its line breaks come from the markup. A bare < in prose is not markup, so HTML is only parsed when Input is HTML is ticked. Markdown mode is a heuristic: it turns capital-only lines, bullet characters and 1) into ##, - and 1..