Invisible characters are real characters that take up no visible space. They hide inside text you paste from chatbots, web pages, and word processors, and they cause problems you cannot diagnose by looking. Here is how to get rid of them.
What counts as an invisible character
The common culprits:
- Zero-width space and zero-width joiner/non-joiner, used in formatting and sometimes as hidden markers.
- Byte-order mark (BOM), an invisible flag at the start of a file.
- Non-breaking space and other exotic spaces, which look like a normal space but behave differently.
- Soft hyphen, an invisible hyphen that only appears at line breaks.
- Direction marks and isolates, used for right-to-left text but often left scattered in copied content.
Why they cause trouble
You cannot see them, but software can:
- They break code, where one zero-width character inside a variable name causes an error you will stare at for an hour.
- They break search and find-and-replace, because the text you are searching for does not match byte-for-byte.
- They corrupt data, throwing off CSV columns, database keys, and JSON parsing.
- They can act as a fingerprint, since their presence often signals the text was machine-generated.
How to remove them
Manual deletion does not work, because you cannot place your cursor on a character you cannot see. You need a tool that targets them by their Unicode code point. A cleaner like textscrubr:
- Scans the text for every known invisible character.
- Removes or normalizes each one (for example, turning a non-breaking space into a normal space).
- Leaves your visible text and structure untouched.
- Shows you a count of exactly what it pulled out, so you can see the otherwise invisible.
It even keeps the zero-width joiners that real emoji rely on, so removing the noise does not break your 👍🏽.
How to check whether text has them
Paste it into a cleaner and look at the report. If it lists zero-width spaces, a BOM, or non-breaking spaces, your text was carrying hidden passengers. Running everything you paste from an AI tool through a cleaner makes this a non-issue.