HandyBench

Text Cleaner

Trim extra spaces, tabs and blank lines.

How to use the Text Cleaner

  1. 1 Paste the text you want to clean.
  2. 2 Pick the operations: collapse spaces, trim lines, remove blank lines.
  3. 3 Copy the tidied text.

The four cleaning passes, in the order they run

Each checkbox is a separate pass, and they run in a fixed order. That order matters, because later steps see the result of earlier ones. Line endings are first normalised to \n.

  1. Strip invisible chars: deletes the zero-width space (U+200B), zero-width non-joiner (U+200C), word joiner (U+2060), soft hyphen (U+00AD), byte-order mark (U+FEFF) and any zero-width joiner (U+200D) that is not part of an emoji sequence. The non-breaking space (U+00A0) is turned into an ordinary space instead, because it stands for a real gap between words.
  2. Collapse spaces: any run of two or more spaces or tabs becomes one space. A single tab on its own is left alone.
  3. Trim lines: spaces and tabs at the start and end of every line are removed.
  4. Remove blank lines: any run of two or more line breaks becomes one. Because trimming has already emptied whitespace-only lines, those are removed as well.

The result is trimmed at both ends before being displayed.

Worked example

Suppose the input is: two leading spaces, Hello, two non-breaking spaces, world, a space, a zero-width space and a space; then two empty lines; then a line with three leading spaces, second, two tabs and line; then trailing blank lines. With all four options on, the output is exactly two lines:

Hello world
second line

Mistakes and limits to know about

  • Paragraph spacing disappears. With "Remove blank lines" on, a blank line between paragraphs is removed too. If you want to keep paragraph gaps, untick that option.
  • Zero-width characters are deleted, not replaced. A zero-width space inside a word turns un​breakable into unbreakable, so the word is not split. A zero-width joiner between emoji (a family, a couple, a person with a profession) is kept, so those emoji stay whole. The zero-width non-joiner is always removed, though Persian and Indic scripts use it on purpose, so untick the option for text in those languages.
  • Not every odd character is covered. Thin spaces, hair spaces and the left-to-right and right-to-left marks (U+200E, U+200F) are left untouched. The Find and Replace tool in regex mode can remove them: a pattern such as [\u2009\u200E\u200F] works.
  • Typography is not changed. Curly quotes, dashes and ellipsis characters stay as they are; the cleaner only deals with whitespace.

Invisible characters are the usual reason a copied value fails to match in a spreadsheet or a search box, and why two names that look identical are treated as different. Running the text through the cleaner and then through Remove Duplicate Lines is a reliable way to deduplicate pasted data. To check the effect on length, paste before and after into the character counter.

Examples

  • ▸ " Hello world " plus a zero-width space and a blank line → "Hello world".
  • ▸ Text pasted from a web page with non-breaking spaces between words → the same text with normal spaces, ready to paste into a spreadsheet.

Frequently asked questions

What are invisible characters and why remove them?

Text copied from the web can contain zero-width spaces, a byte-order mark or non-breaking spaces that break matching, searches and spreadsheet lookups. The cleaner deletes zero-width spaces (U+200B), zero-width non-joiners (U+200C), word joiners (U+2060), soft hyphens (U+00AD), byte-order marks (U+FEFF) and stray zero-width joiners (U+200D), so a word is never split. Non-breaking spaces (U+00A0) become ordinary spaces. A zero-width joiner that glues emoji together, such as in a family emoji, is kept.

Does cleaning remove my actual content?

No. It only changes whitespace and hidden characters; your words, numbers and punctuation are left intact. Be aware that "Remove blank lines" also removes the gaps between paragraphs, so untick it if you want to keep them.

In what order are the cleaning steps applied?

Invisible characters are removed first, then runs of spaces and tabs are collapsed, then each line is trimmed, and finally blank lines are removed. Because trimming runs before blank-line removal, lines containing only spaces are removed too.

Which hidden characters does it not handle?

Thin spaces, hair spaces and the left-to-right and right-to-left marks (U+200E, U+200F) are not touched. You can remove them with the Find and Replace tool in regex mode, for example with a pattern like [\u2009\u200E\u200F]. Persian and Indic text uses the zero-width non-joiner on purpose, so untick "Strip invisible chars" for those languages.

Is my text uploaded anywhere?

No. Cleaning runs entirely in your browser, so the text you paste never leaves your device.