A zero-width space is an invisible Unicode character, U+200B ZERO WIDTH SPACE, that takes up no room on screen but marks a spot where a line is allowed to break. Use the copy button below to get one; it will look like nothing was copied, but the character is on your clipboard.
DetailsZero-width space at a glance
| Property | Value |
|---|---|
| Code point | U+200B |
| Unicode name | ZERO WIDTH SPACE |
| Decimal | 8203 |
| UTF-8 bytes | E2 80 8B |
| HTML | ​, ​ or ​ |
| CSS / JavaScript | "200B" / "u200B" |
| General category | Cf (format character), not a regular space |
Full details, including all encodings, are on the zero width space reference page.
What it actually does
Browsers and word processors normally only wrap lines at spaces and hyphens. A long unbroken string, such as a URL, a file path or a long compound word, can overflow its container or stretch a table cell. Inserting a zero-width space inside that string gives the layout engine a legal place to break the line, without adding any visible gap when the line does not break.
It does not prevent a break, add spacing, or join anything. Those jobs belong to its relatives, covered below.
How to insert a zero-width space
Copy and paste
The simplest method: use the copy button at the top of this page, then paste. Because it is invisible, paste it where you want it and move on; you will not see it arrive.
HTML
Write ​ (or ​) exactly where a break is allowed, for example very​long​identifier. For web pages, the <wbr> element does the same job and is easier to see in your source. For breaking long URLs and words in general, the CSS property overflow-wrap: anywhere (or overflow-wrap: break-word) is often a cleaner fix than inserting characters.
Microsoft Word
Type 200B and immediately press Alt + X. Word converts the code into the character. Turn on Show/Hide formatting marks if you want to confirm it is there.
Windows and Mac
There is no Windows Alt code and no standard Mac keyboard shortcut for U+200B. Copy it from this page or from the spaces and invisible characters category, where each character is labeled.
Code
In JavaScript, Java, C#, JSON and Python string literals, write u200B. This is far safer than pasting the raw character into source code, where no one can see it.
Its invisible relatives
Several zero-width characters are easily confused. They look identical (they look like nothing) but do very different things:
| Character | Code point | HTML | What it does |
|---|---|---|---|
| Zero width space | U+200B | ​ |
Allows a line break, no visible width |
| Zero width non-joiner (ZWNJ) | U+200C | ‌ |
Stops two letters from joining or forming a ligature |
| Zero width joiner (ZWJ) | U+200D | ‍ |
Asks neighboring characters to join, and glues emoji sequences together |
| Word joiner | U+2060 | ⁠ |
Prevents a line break, no visible width |
| Byte order mark (BOM) | U+FEFF |  |
Marks encoding at the start of a file; inside text it is an obsolete no-break character |
Zero width non-joiner (U+200C)
In scripts where letters connect, such as Arabic and Persian, the ZWNJ keeps two adjacent letters in their unjoined forms without inserting a space. It is a normal, required part of correct Persian spelling. In Latin text it can also break up an automatic ligature, such as “fi” in some fonts.
Zero width joiner (U+200D)
The ZWJ is how many modern emoji are built. The family emoji 👨👩👧 is man + ZWJ + woman + ZWJ + girl, five code points that display as one picture on supported devices. The rainbow flag is a white flag, a variation selector, a ZWJ and a rainbow. Remove the joiners and the emoji fall apart into separate pictures. ZWJ is also used in Indic scripts to request particular conjunct forms.
Word joiner (U+2060)
The word joiner is the opposite of the zero-width space: it forbids a line break at that point. Use it to keep two things together without adding a visible space, for example a slash-separated pair you do not want split. For a visible space that will not break, use the non-breaking space instead.
Byte order mark (U+FEFF)
At the very beginning of a file, U+FEFF signals the byte order of UTF-16 text, or simply that a file is UTF-8. Anywhere else, its old meaning of “zero width no-break space” is deprecated in favor of the word joiner. An unwanted BOM at the start of a PHP, JSON or CSV file is a frequent source of hard-to-see bugs, such as “headers already sent” errors in WordPress or a first column name that does not match.
Legitimate uses
- Breaking long strings in narrow layouts: URLs, email addresses, file paths, chemical names and code identifiers in documentation.
- Languages written without spaces between words, such as Thai, Khmer, Lao and Burmese, where a zero-width space can mark word boundaries for line breaking.
- Stopping auto-formatting. Some chat apps, wikis and Markdown renderers turn text like @name, #tag or a URL into a link or mention. A zero-width space in the middle stops the conversion while the text still looks the same.
- Showing an example of something that would otherwise be interpreted, such as a sample mention in a help article.
Gotchas and problems
Because nobody can see it, a stray zero-width space causes confusing bugs:
- Search and matching fail. “hello” and “hel” + U+200B + “lo” look identical on screen but are different strings. Searches, spreadsheet lookups such as VLOOKUP, spam filters and duplicate checks will not match them.
- Passwords and usernames break. A zero-width character copied along with a password makes it wrong, and you cannot see why.
- Code fails to compile. Pasting code from a web page or chat can bring U+200B along, producing errors like “invalid character” on a line that looks perfect.
- Trimming does not remove it. U+200B is a format character, not whitespace. JavaScript’s
trim()ands, and Python’sstrip()andisspace(), do not treat it as a space. (JavaScript does treat U+FEFF as whitespace, which adds to the confusion.) - Character counts are off. Social media limits, form validation and database field lengths count it as a character.
- It can be misused to disguise words from filters or make two different usernames look identical. Many platforms strip or flag zero-width characters for this reason.
How to find and remove zero-width spaces
- Inspect the text: paste it into the Unicode Lookup tool, which lists every code point, including invisible ones.
- Code editors: many editors, including VS Code, can highlight invisible or unusual Unicode characters.
- JavaScript:
text.replace(/[u200B-u200Du2060uFEFF]/g, '') - Python:
re.sub('[u200b-u200du2060ufeff]', '', text) - Excel:
=SUBSTITUTE(A1, UNICHAR(8203), "") - Word: use Find and Replace and search for
^u8203, replacing it with nothing.
Be careful with blanket removal. Stripping U+200C and U+200D from Persian text or emoji changes their meaning and appearance. Remove only the characters you know are unwanted.
Frequently asked questions
Is a zero-width space the same as a blank or empty character?
It is a real character with a code point, not an absence of one. It just has no width and no visible shape. Some people use it to post “empty” messages or names, but many apps now strip it or treat the field as empty.
What is the difference between a zero-width space and a non-breaking space?
A zero-width space has no width and allows a line break. A non-breaking space (U+00A0) has the normal width of a space and prevents a line break.
Why does my copied text contain U+200B?
The source page, document or app inserted it, often to help long text wrap or to stop auto-linking. It comes along when you copy.
Does a zero-width space affect SEO?
It can if it lands inside words in your titles or content, because search engines may see the word as two separate pieces or an unfamiliar string. Keep invisible characters out of important text.