Home / Guides / Zero-width characters: what they are and how to find them
Zero-width characters: what they are and how to find them
Zero-width characters are invisible Unicode characters, such as U+200B, that take up no space but can break searches, word counts and code. Removing them is safe in plain English text. Leave them alone in scripts like Persian and Hindi and inside emoji sequences.
A zero-width character is a character that takes up no visible space. You can't see it, but your computer can, and it is a common reason that a search finds nothing, a word count looks wrong or a pasted password is refused.
What they are
Unicode, the standard that defines text on computers, includes several characters that are deliberately invisible. The best known is the zero-width space, written U+200B. Others include the zero-width joiner (U+200D), the zero-width non-joiner (U+200C), the word joiner (U+2060), the soft hyphen (U+00AD) and the byte order mark (U+FEFF).
They exist for good reasons. A zero-width space marks where a line may break in writing that has no spaces between words. Joiners control how letters connect in scripts such as Persian and Hindi, and they glue emoji into sequences like a family or a profession. Direction marks help mixed left-to-right and right-to-left text display in the right order.
Where they come from
- Copying from web pages, where they are used for layout and line breaking.
- Copying from PDFs and word processors, which insert soft hyphens and joiners.
- Chat and email tools that add formatting characters when you copy a message.
- Some AI tools and editors that leave formatting or reference markers in the text you copy.
- Occasionally on purpose, for example to trace where a piece of text was copied.
The problems they cause
- Find and replace fails, because the word you typed is not the same as the word in the document.
- Word and character counts are off by a few.
- A link, code snippet or password pasted from a page is rejected for an invalid character.
- Two lines that look identical are treated as different by a spreadsheet or a diff tool.
- Form validation and spam filters trip on text that looks fine.
How to find them
The quickest way is to paste the text into a cleaner that lists what it finds. In Paste & Wash, the report under the tool names each hidden character with its code and lets you see where it sits in the text.
If you work in code, most editors can show them. Visual Studio Code highlights invisible characters by default, and many editors have a setting to render control characters. Searching for the character by its code with a regular expression such as \u200B also works.
When they should stay
In plain English text, removing zero-width characters is safe. In Persian, Arabic, Hebrew, Hindi and other scripts, and inside emoji sequences, some of them are part of the writing. Stripping them can change how words look or split a family emoji into separate people. Paste & Wash leaves those alone when your text uses them, and tells you what it kept.
Do they show that AI wrote something?
No. Zero-width characters turn up in text copied from many sources, and their absence proves nothing either. They are not a dependable sign of where a piece of writing came from, so don't treat them as evidence. Removing them makes text tidier. It doesn't change who wrote it.
Quick reference
- U+200B zero-width space: allows a line to break with no visible gap.
- U+200C zero-width non-joiner and U+200D zero-width joiner: control how letters connect, and glue emoji into sequences.
- U+2060 word joiner: stops a line from breaking at that point.
- U+00AD soft hyphen: shows a hyphen only if the word breaks across two lines.
- U+FEFF byte order mark, also known as the zero-width no-break space.
- U+200E and U+200F left-to-right and right-to-left marks: guide the direction of mixed text.
How to remove them by hand
In a code editor with regular expression search switched on, search for [\u200B\u2060\uFEFF] and replace with nothing. Leave U+200C and U+200D alone unless you are sure the text is plain English, because they matter in Persian, Hindi and emoji sequences.
In Python, text.replace("\u200b", "") removes one kind of character, and you can chain further calls for the others. For everyday writing, a cleaner that lists what it found is quicker and shows you what was there.
Try the cleaner to see what is hiding in your own text.