Zero width space (U+200B) in HTML
A zero width space marks a place where a line may break without adding any visible space. Its code point is U+200B and the HTML5 name for it is ​.
At a glance
- Character
- (invisible, zero width)
- Named entity
- ​ in HTML5
- Decimal reference
- ​
- Hex reference
- ​
- Unicode code point
- U+200B
- Unicode name
- ZERO WIDTH SPACE
- In the entity reference
- Not in the 152 entity list
In detail
The character is a break opportunity and nothing else. It occupies no width, draws nothing, and its only effect is to tell the line breaking algorithm that it may wrap here if it needs to. That makes it the traditional answer for a long unbroken string, a URL or a hash or a file path, that would otherwise force a container to scroll sideways.
HTML has a purpose built element for the same job. The wbr element is a break opportunity in markup rather than a character in the text, which means it does not travel with the string when someone copies it, does not affect a length calculation and cannot be accidentally saved into a database. Where you control the markup, it is the better tool.
The reason to care about that distinction is that an invisible character in stored data is genuinely destructive. It makes two identical looking strings unequal, it breaks an exact match lookup, it can corrupt a copied command or password, and it is impossible to find by reading the text. Code that has been pasted from a page can fail with an error message that points at a character nobody can see.
It also has a reputation problem. Because it is invisible and survives copying, sequences of zero width characters have been used to watermark and fingerprint text, so a document that arrives with them scattered through it may have been marked deliberately. That is a reason to strip them on ingest rather than to leave them in place.
Examples
<!-- character in the text -->
<code>abcdef​123456​789abc</code>
<!-- markup instead, nothing added to the string -->
<code>abcdef<wbr>123456<wbr>789abc</code>const clean = (s) => s.replace(/[\u200B-\u200D\uFEFF]/g, "");
clean("pass\u200Bword") === "password"; // trueThe range also covers the zero width non-joiner, joiner and the byte order mark.
Things that catch people out
- Two strings that look identical will compare as different if one contains this character. There is no visual clue at all.
- It is not in the entity reference tool's list of 152, so look it up by code point rather than expecting a named entry.
- Using it for visual spacing does nothing, because it has no width. It only creates a place to break.
Try it: HTML Entity Reference
Search 152 entities across 9 categories, switch the copy format between the character, the name, the decimal form and the hex form, and copy in one click.
HTML Entity Reference
LOCAL · Browser-OnlySearchable reference of 150+ HTML entities with one-click copy in any format
152 entities across 9 categories
Commonly Used
→Arrows(13)
±Math(35)
$Currency(8)
…Punctuation(21)
©Symbols(24)
πGreek(30)
½Fractions(6)
●Geometric(7)
æLatin Special(8)
Click any entity card to copy it in your chosen format. All data is embedded in the page and works offline.
Related HTML entities
All html entities →Soft hyphen (­) in HTML
The soft hyphen at U+00AD, what it does that a normal hyphen cannot, why it wrecks copy and search, and when CSS hyphenation is the better answer.
Non-breaking space ( ) in HTML
The no-break space at U+00A0, what it prevents beyond line breaking, why it defeats site search, and the CSS properties that do the job better.
Thin space ( ) in HTML
The thin space at U+2009, its named reference, its use as a digit group separator, and the narrow no-break space that stops a number splitting.
Em space ( ) and en space ( ) in HTML
The em space at U+2003 and en space at U+2002, their named references, how their widths track the font size, and why CSS is usually the better tool.
Ampersand (&) in HTML
The ampersand opens every character reference, so a bare & in markup is ambiguous. What & fixes, and the query string trap that quietly eats a parameter.
Less than sign (<) in HTML
A literal < starts a tag, so text containing it has to be written <. Where the parser recovers, where it does not, and why this is the core of escaping.
Tools for this
- Unicode Character Finder Free online unicode character finder - search and copy special Unicode characters and symbols
- HTML Entity Reference Free online HTML entity reference - search and copy HTML entities with live preview