Text encoding

Zero-Width Space

A character with no width, no visible mark, and a habit of quietly riding along in text copied from certain websites and word processors.

What it is

A zero-width space (U+200B) is a character that occupies a position in a string — it counts toward the length, it can be selected and copied — but renders with no visual width at all. It doesn't look like a space; it looks like nothing.

What it's actually for

Some writing systems, notably Thai and Khmer, don't use spaces between words the way English does. Browsers and text-layout engines still need to know where they're allowed to break a line, so a zero-width space is inserted at word boundaries as an invisible hint: "you may wrap the line here if needed," without introducing a visible gap.

How it ends up in text it doesn't belong in

Outside that legitimate typesetting use, zero-width spaces show up by accident more often than on purpose:

  • Copied from certain websites — some sites insert zero-width characters into text as an invisible watermark, letting them trace where copied content resurfaces elsewhere online.
  • Word processor artifacts — some rich-text editors insert them as internal formatting hints that survive a copy-paste into plain text.
  • Generated text — some AI writing and text-generation tools have been observed leaving them behind, likely as an artifact of how the output was assembled.

What it breaks

Because it's invisible but real, a zero-width space causes exactly the class of bug that's hardest to debug by eye: a word count that's off by one, a regex pattern that mysteriously doesn't match a string that looks identical to the pattern, or two pieces of text that look the same on screen but fail an equality check. The text "looks fine" because, visually, it is fine — the problem is a character you can't see.

How to find one

Paste the suspect text into the invisible character finder — every zero-width space gets rendered as a visible, labeled highlight with its Unicode code point, and the cleaned output has them stripped.

Source

The zero-width space is defined as part of the Unicode Standard, maintained by the Unicode Consortium.

Related

BOM (Byte Order Mark) Invisible Character Finder

Back to the full glossary — 200 terms covering case conversion, style guides, and text tools.