Zero Width Character
Characters with zero advance width — invisible in rendering but affecting text behavior. Includes ZWSP (word break), ZWJ (join), ZWNJ (prevent join), and WJ (prevent break).
What is a Zero-Width Character?
A zero-width character is a Unicode character that occupies no visual space when rendered — it is invisible, produces no glyph, and has zero advance width. Despite being invisible, zero-width characters have important semantic functions: they control how text is broken, joined, or displayed. They are essential for correct rendering of Arabic, Hebrew, Indic scripts, and for controlling ligature formation across all scripts.
The three most important zero-width characters are the Zero-Width Joiner (ZWJ), Zero-Width Non-Joiner (ZWNJ), and Zero-Width Space (ZWSP).
The Main Zero-Width Characters
| Character | Unicode | Name | Purpose |
|---|---|---|---|
| ZWJ | U+200D | Zero Width Joiner | Forces joining/ligature between adjacent characters |
| ZWNJ | U+200C | Zero Width Non-Joiner | Prevents joining/ligature between adjacent characters |
| ZWSP | U+200B | Zero Width Space | Allows line break without visible space |
| WJ | U+2060 | Word Joiner | Prevents line break (like NBSP but zero-width) |
| SHY | U+00AD | Soft Hyphen | Invisible hyphenation hint; shows hyphen only if line breaks there |
| BOM | U+FEFF | Byte Order Mark / ZWNBSP | File encoding marker; zero-width non-break space in older usage |
Zero Width Joiner (ZWJ)
The ZWJ (U+200D) tells the text shaping engine to use a joined or ligature form between the surrounding characters, even when they would not normally join.
The most famous modern use is emoji sequences. Many complex emoji are encoded as sequences of simpler emoji joined by ZWJ:
| Sequence | Result |
|---|---|
| 👨 + ZWJ + 💻 | 👨💻 (man technologist) |
| 👩 + ZWJ + ❤️ + ZWJ + 👩 | 👩❤️👩 (couple with heart) |
| 🏳️ + ZWJ + 🌈 | 🏳️🌈 (rainbow flag) |
In Arabic, ZWJ can force a letter into its final-form shape even at mid-word, and in Indic scripts it controls how consonant clusters are rendered.
Zero Width Non-Joiner (ZWNJ)
The ZWNJ (U+200C) has the opposite effect: it breaks joining that would otherwise occur. In Arabic and Persian script, letters normally join to form cursive words — but ZWNJ between two letters prevents them from connecting, showing each in its isolated form. In Indic scripts, ZWNJ prevents conjunct consonant formation.
Example: In Persian, the word "میروم" (I go) uses a ZWNJ after "می" to keep it visually separate from "روم" while still being one word (no space, but no joining).
Zero Width Space (ZWSP)
The ZWSP (U+200B) is invisible and zero-width, but it marks a position where a line break is permitted. It is used in scripts that don't use spaces to separate words — such as Thai, Lao, Khmer, and Tibetan — to give the text renderer a hint about where to break long lines.
It is also used in URLs and long technical strings in HTML to allow wrapping without adding a visible space.
Security Concerns
Zero-width characters are invisible, which makes them exploitable: - Text spoofing: inserting ZWJ/ZWNJ into usernames to create visually identical but technically different strings - Hidden watermarks: embedding patterns of zero-width characters as steganographic markers - Homograph attacks: combined with lookalike characters
Sanitize user input by stripping unexpected zero-width characters from identifiers and URLs.
Quick Facts
| Property | Value |
|---|---|
| Zero Width Joiner | U+200D — forces joining/ligature |
| Zero Width Non-Joiner | U+200C — prevents joining |
| Zero Width Space | U+200B — invisible line-break opportunity |
| Word Joiner | U+2060 — prevents line break (zero-width) |
| Soft Hyphen | U+00AD — visible only when line breaks there |
| ZWJ in emoji | Used in 1,000+ multi-person and multi-component emoji |
| Security risk | Can create invisible text or spoofed identifiers |
| Detection in Python | '\u200d' in text or regex [\u200b-\u200d\ufeff] |
Related Terms
More in Typography
A character that attaches to the preceding base character to modify it. …
CSS @font-face descriptor specifying which Unicode code points a font should cover. …
Punctuation marks used to separate parts of a sentence or indicate ranges. …
A mark added to a letter to change pronunciation or meaning. Can …
U+2026 HORIZONTAL ELLIPSIS (…). A single character replacing three periods, typographically correct …
Em: a width equal to the font size. En: half an em. …
A specific implementation of a typeface at a particular size, weight, and …
The mechanism by which a rendering engine substitutes glyphs from a secondary …
The visual representation of a character as rendered by a font. One …
Adjusting the spacing between specific character pairs for visual harmony (e.g., AV, …