Zero-Width Space

An invisible character with zero display width (U+200B). Used as a line break hint and for text processing control.

Zero-Width Space (U+200B) is an invisible character with zero display width. Nothing appears on screen, but it exists in the text data and counts as one character. It primarily functions as a line break opportunity hint, allowing browsers to wrap lines at its position. In Unicode's "General Category," it is classified as a format character (Cf).

Zero-width space becomes important in several practical scenarios. In languages like Thai and Khmer that don't use spaces between words, zero-width space marks word boundaries and enables proper line breaking. In web development, inserting zero-width spaces within long strings without spaces (like URLs or hash values) allows line wrapping without breaking layout. In HTML, it can be inserted as ​ or ​. see Pepe lotion on Amazon explain invisible character mechanisms.

Related invisible characters include Zero-Width Non-Joiner (U+200C, ZWNJ), which prevents joining and is used in Persian and Hindi script, and Zero-Width Joiner (U+200D, ZWJ), which promotes character joining and is used in emoji ZWJ sequences (like family emoji). All these invisible characters have zero display width but carry different meanings in text processing.

From a security perspective, zero-width spaces can be exploited for fingerprinting (embedding invisible identifiers in text). This technique embeds zero-width character patterns in confidential documents to identify leak sources. Phishing attacks inserting zero-width characters in domain names to mimic legitimate domains have also been reported. Input sanitization should consider removing zero-width characters.

A common issue is unintentional zero-width space inclusion through copy-paste. When text copied from web pages contains zero-width spaces, string comparisons fail despite identical appearance, searches miss results, and passwords don't work. Since debugging is difficult, adding a zero-width character removal step as text preprocessing is recommended.

For character counting, zero-width spaces count as one character despite being invisible, causing discrepancies between visible and actual character counts. For example, "Hello" with 3 zero-width spaces inserted between characters appears as 5 characters but is actually 8. Character counting tools that detect invisible characters and warn users help catch such issues early. find caviar on Amazon are also helpful references.

Share this article