A zero-width space is one of those characters that does nothing visible and causes outsized trouble. Here is what it is and how to deal with it.
What it is
The zero-width space, Unicode code point U+200B, is a character with no width. It was designed to mark where a word could break across a line without showing a visible space. Because it renders as nothing, you cannot see it, but it is genuinely there, occupying a position in the text like any other character.
It has invisible relatives: the zero-width joiner (U+200D), the zero-width non-joiner (U+200C), and the word joiner (U+2060). They all do subtle text-shaping jobs and all hide in plain sight.
Why it ends up in your text
- Copying from web pages, where it was used for line-break control.
- AI-generated text, where it sometimes appears in the output.
- Word processors and PDFs, which insert it for layout.
- Deliberate insertion, occasionally as a hidden marker or watermark.
Why it is a problem
Because software sees it even though you do not:
- A zero-width space inside a variable name or string breaks your code with an error that is invisible in the editor.
- It breaks search and find-and-replace, since the match no longer lines up byte-for-byte.
- It corrupts keys, CSV columns, and JSON, where an extra invisible character changes the value.
- It can flag text as machine-generated.
How to remove a zero-width space
You cannot click on it or backspace it reliably, because there is nothing visible to target. The dependable method is a cleaner that removes it by its code point. Paste your text into textscrubr and it strips U+200B and its invisible siblings in one pass, then shows you how many it found, so the invisible becomes visible. It keeps the zero-width joiners that real emoji need, so your emoji do not break.
Prevent it from coming back
If you regularly paste from chatbots, web pages, or documents, make cleaning a habit before the text lands anywhere that matters. It takes seconds and removes a whole class of bugs you would otherwise never see coming.