Zero-Width Spaces and Joiners Explained
What zero-width spaces and joiners do, why emoji and Indian scripts need them, how they are abused to fingerprint text and hide code, and how to see them.

The short answer
A zero-width character is a real Unicode character that occupies no space on screen. There are five you will meet in practice: the zero-width space (U+200B), the zero-width non-joiner (U+200C), the zero-width joiner (U+200D), the word joiner (U+2060) and the zero-width no-break space (U+FEFF), better known as the byte order mark.
They exist for good reasons. Emoji families, Hindi half letters and Persian verbs depend on them, and several Asian scripts use them to mark where a line may break. They are also abused: to fingerprint copied text, to slip banned words past filters and, together with their cousins the bidi controls, to make source code run differently from how it reads.
So the useful question is never "how do I delete them all". It is "is this one doing a job, or did it arrive by accident". This page explains both sides, shows real examples with code points, gives you every one of the five characters to copy, and ends with the cases where you must not strip them. If all you need is to know what is hiding inside one piece of text, paste it into the Invisible Character Detector and come back.
The five zero-width characters
| Code point | Name | Job |
|---|---|---|
| U+200B | Zero-width space | Marks a place where a line may break, without showing a space |
| U+200C | Zero-width non-joiner (ZWNJ) | Stops two neighbouring characters from joining or forming a ligature |
| U+200D | Zero-width joiner (ZWJ) | Asks two neighbouring characters to join into one form |
| U+2060 | Word joiner | Forbids a line break at that point, with no width |
| U+FEFF | Zero-width no-break space | Today used only as a byte order mark at the start of a file |
Two related characters are also invisible: the left-to-right mark (U+200E) and right-to-left mark (U+200F). They do not join or break anything. They nudge the direction of neighbouring text, and they belong to the bidi family discussed further down.
Every one of them counts as a character. A username with a zero-width space after it is six characters long, not five, which is why the character counter can disagree with your eyes.
The names people use: zero-width character, 0 width space, ZWSP
There is no single official term for this group, so the same five characters arrive under a dozen spellings. "Zero-width character" is the usual umbrella, and it is the one worth searching for, because it covers the joiners and the word joiner as well as the space. "0 width space" and "0-width space" are the same character written with a digit: U+200B, zero-width space. "Invisible character" is broader again, and usually takes in the no-break space and the direction marks too.
The short forms turn up in bug reports and code comments more often than the full names.
| Short form | Full name | Code point |
|---|---|---|
| ZWSP | Zero-width space | U+200B |
| ZWNJ | Zero-width non-joiner | U+200C |
| ZWJ | Zero-width joiner | U+200D |
| WJ | Word joiner | U+2060 |
| ZWNBSP, BOM | Zero-width no-break space, byte order mark | U+FEFF |
| NBSP | No-break space, which is not zero width: it takes a space worth of room | U+00A0 |
| SHY | Soft hyphen, which shows a hyphen only where the line breaks | U+00AD |
Zero-width breaking space: there is no such character
No character has ever been published under the name "zero-width breaking space", and the phrase is usually reaching for one of two opposites.
In Unicode's line-breaking rules, UAX #14, U+200B belongs to the class named ZW, whose entire job the specification states as "provide a break opportunity", and it describes the character as the one "used to enable additional (invisible) break opportunities wherever SPACE cannot be used". So the zero-width space is the breaking one.
The character that forbids a break is the word joiner, U+2060, in the class named WJ: "prohibit line breaks before and after". UAX #14 is direct about which to use. "The word joiner character is the preferred choice for an invisible character to keep other characters together that would otherwise be split across the line at a direct break. The character FEFF has the same effect, but because it is also used in an unrelated way as a byte order mark", the word joiner is preferred. That sentence is the whole reason U+FEFF now means only "byte order mark" in new text.
So "zero-width breaking space" is U+200B, and "zero-width non-breaking space" is U+FEFF, whose job U+2060 has taken over. One corollary that saves an argument about layout: when a renderer stretches or squeezes the spaces of a justified line, UAX #14 says "the presence of U+200B ZERO WIDTH SPACE or U+2060 WORD JOINER is always ignored", so neither of them ever grows into a visible gap.
Invisible is not the same as zero width
A zero-width character takes no room at all, which is why it cannot be used to make a value look blank. The characters people reach for when they want an empty-looking name are different ones that do occupy width: U+3164 Hangul filler and U+2800 braille pattern blank both draw as a gap, and U+00A0 is an ordinary-width space that refuses to break or collapse. They have no ink, which is not the same as having no width. The detector names all of them, which is why a field that "looks empty" so often comes back with a character in it.
Copy and paste each zero-width character
Each box below holds exactly one character, so its Copy button puts that character and nothing else on your clipboard. The box looks empty because the character has no width. That is the character doing its job, not a page fault. Nothing on screen can tell you whether the paste landed, so check the result in the Invisible Character Detector: it names every code point it finds and counts them, in your browser, and the text is never uploaded.
Zero-width space, U+200B. A place where a line may break, with no space shown.
Zero-width non-joiner, U+200C. Keeps the two characters around it from joining or forming a ligature.
Zero-width joiner, U+200D. Asks the two characters around it to join, and is what holds a multi-person emoji together.
Word joiner, U+2060. Forbids a line break at that point, with no space.
Zero-width no-break space, U+FEFF. The byte order mark. Prefer the word joiner above unless you actually want a BOM.
The same five characters, written out
An invisible character on a clipboard is easy to lose and impossible to review. Wherever you can, write the character instead of pasting it.
| Code point | HTML | Escape in code | Percent-encoded |
|---|---|---|---|
| U+200B | ​ or ​ | \u200b | %E2%80%8B |
| U+200C | ‌ | \u200c | %E2%80%8C |
| U+200D | ‍ | \u200d | %E2%80%8D |
| U+2060 | ⁠ or ⁠ | \u2060 | %E2%81%A0 |
| U+FEFF |  (no name exists) | \ufeff | %EF%BB%BF |
The escape column is the same in JavaScript, Java, Go, C#, Python and JSON. Rust and modern C use braces: \u{200b}. The HTML names come from the HTML standard's own named character reference table, which also lists ​, ​, ​ and ​ as four more names for that one zero-width space, a good reminder of how little these names tell you. U+FEFF has no name at all, so write the number.
The percent forms are just the character's UTF-8 bytes, which is worth knowing when a link misbehaves: a zero-width space inside a URL travels as %E2%80%8B, so an address that reads correctly in an email can point at a page that does not exist.
The invisible neighbours: direction marks, variation selector, no-break space and soft hyphen
Five more invisible characters are named in the prose on this page without a box of their own. Two are the direction marks, one belongs to an emoji, one is a space that will not break, and one is a hyphen that appears only at a line break. Each box holds exactly one character, and the Invisible Character Detector names every one of them.
Left-to-right mark, U+200E. Nudges the direction of neighbouring text, and joins or breaks nothing.
Right-to-left mark, U+200F. Also nudges the direction of neighbouring text, and belongs to the bidi family discussed below.
Variation selector, U+FE0F. Part of the emoji it follows, such as a heart or a digit.
️No-break space, U+00A0. An ordinary-width space that refuses to break or collapse, so it is not zero width.
Soft hyphen, U+00AD. Shows a hyphen only where the line breaks.
Written out, in the same four forms:
| Code point | HTML | Escape in code | Percent-encoded |
|---|---|---|---|
| U+200E | ‎ or ‎ | \u200e | %E2%80%8E |
| U+200F | ‏ or ‏ | \u200f | %E2%80%8F |
| U+FE0F | ️ (no name exists) | \ufe0f | %EF%B8%8F |
| U+00A0 | or   | \u00a0 | %C2%A0 |
| U+00AD | ­ | \u00ad | %C2%AD |
The two names most people already know sit in this group: and ­ come from the same named character reference table as the names above, which also lists   for the no-break space. U+FE0F has no name at all, so write the number, exactly as with U+FEFF. The percent forms are again the character's UTF-8 bytes, and the no-break space and soft hyphen sit low enough in Unicode to need only two bytes each, so they travel as two percent groups rather than three.
Typing one, without a clipboard
- Word and Outlook. Type
200bwhere the character belongs and press Alt+X. Microsoft's instructions add that when the code sits straight after other text, you should select just the code before pressing Alt+X. - Any browser. Open the developer tools console and run
copy('\u200b'). Thecopy()helper in the Console Utilities API puts its argument on the clipboard, and it works only in the console, never from a page script. - A terminal.
printf '\u200b' > zwsp.txtwrites the three bytes, andod -c zwsp.txtprints them back as342 200 213, which is E2 80 8B. Pipe it topbcopyon macOS orxclip -selection clipboardon Linux instead of a file. - Excel and Google Sheets.
=UNICHAR(8203)returns the character, since 8203 is 200B in decimal, and=SUBSTITUTE(A1,UNICHAR(8203),"")clears it out of a column you are about to export.
Where not to paste one
A zero-width space pasted into page content to fix a layout problem is a debt. It travels into every copy of that text, into search keys, exports and your database, and the next person to edit the page cannot see it. The web has purpose-built tools for the same jobs, and they stay in the markup where a reviewer can read them:
- To allow a break inside a long string, use the
<wbr>element, which MDN describes as a spot where the browser may break the line even though its normal rules would not. - To allow a break and show a hyphen when it happens, use
­, the soft hyphen, U+00AD. - To let any long word break, do it in CSS with
overflow-wrap: anywhereon the container. - To stop a break between two words,
white-space: nowrapon a span needs no invisible character at all.
Legitimate uses: why Unicode needs them
Line-break hints
Thai, Lao, Khmer and Burmese are written without spaces between words. Text in those scripts can carry U+200B so a browser knows where it may wrap a line. In English the same character turns up in long URLs, file paths and compound product names, where an editor adds it so a narrow column can break the string instead of overflowing.
The word joiner, U+2060, does the opposite: it glues two pieces together so the line never breaks between them. It replaced the old "zero-width no-break space" role of U+FEFF, which is why U+FEFF now only means byte order mark.
Emoji sequences
Many emoji are not single characters. The family of two women and a girl is three separate emoji glued together with two zero-width joiners: U+1F469, U+200D, U+1F469, U+200D, U+1F467. A phone or browser that knows the sequence draws one family picture. Remove the joiners and you get three separate faces in a row.
Profession emoji work the same way. The woman technologist is U+1F469 (woman), U+200D, U+1F4BB (laptop). Remove the joiner and the reader sees a woman next to a laptop.
Indian scripts and Persian
In Devanagari, the script used for Hindi and Marathi, a consonant followed by a virama usually fuses with the next consonant into a conjunct. Adding a zero-width joiner after the virama asks for the half form instead. The zero-width non-joiner asks for the full consonant with a visible virama. Sinhala uses the joiner for some of its standard letter combinations, and older Malayalam text used it for the chillu letters. In all of these the joiner is part of the spelling.
Persian uses the zero-width non-joiner constantly. The verb meaning "I want" is written with the prefix U+0645 U+06CC, then U+200C, then the stem, so the prefix stays visually separate from the stem while the whole remains one word. Without it, the letters join and the word reads wrong to a Persian speaker.
Here is what removing the joiner does to real text, rendered by Chrome on macOS with the code points listed between:
Each row on the right is the same text with only the U+200D or U+200C deleted. The family becomes three people, the Hindi half form becomes a different conjunct, and the Persian prefix fuses into the stem. A cleanup script that strips "all zero-width characters" makes exactly these changes, silently, in every record it touches.
The abusive uses
Fingerprinting and watermarking copied text
Because the characters are invisible and survive copy and paste, they can carry a hidden message. A sequence of zero-width spaces and non-joiners can encode a user id in binary, one bit per character, and be tucked between the words of a document. Every copy looks identical on screen. When a copy leaks, the pattern inside it identifies whose copy it was.
The technique has been publicly documented for years, and it is simple enough that anyone handling sensitive text should assume it is possible. To check a document, paste two copies from different sources into the text diff tool: if lines that look the same are reported as different, something invisible differs between them. The Invisible Character Detector then tells you what it is.
Slipping past filters
A word filter that blocks "casino" does not block "cas" + U+200B + "ino", which looks the same to a reader. The same trick has been used against email security: in 2019 Avanan reported a phishing technique it called Z-WASP, which hid zero-width characters inside the links of emails so the security scan did not recognise the malicious address. A reader saw a normal link. The scanner saw a string it had never been told about.
Any system that matches text against a list, whether for moderation, spam, fraud or banned passwords, should remove or normalise these characters before it compares anything.
Homographs and Trojan Source
Zero-width characters have a close relative in the bidirectional controls. U+202A to U+202E and U+2066 to U+2069 change the order in which text is displayed, so that right-to-left scripts such as Arabic and Hebrew can sit inside left-to-right text. They are invisible too.
In 2021, Nicholas Boucher and Ross Anderson of the University of Cambridge published "Trojan Source" (CVE-2021-42574). They showed that bidi controls placed inside comments and string literals make source code display one way in an editor and code review, while the compiler reads it another way. Here is their "stretched string" example, rendered by Chrome, and the same bytes with the controls made visible:
To a reviewer the condition reads accessLevel != "user", which is false for a user, so the admin line looks unreachable. The interpreter sees a string that starts with user and continues with the controls and the comment text, so the condition is true and the admin line runs. We executed those exact bytes in Node and it printed "You are an admin."
The disclosure changed tools. GitHub warns when a file contains bidirectional text, GCC 12 added the -Wbidi-chars warning, and the Rust compiler refuses bidi controls in comments and string literals unless a lint is explicitly allowed. Homograph attacks are the visible cousin: a Cyrillic "а" (U+0430) in place of a Latin "a" in a domain or an identifier. That one is not invisible, but it fools a human the same way, and VS Code flags it as an ambiguous character.
Hidden instructions for AI tools
A newer abuse uses the Unicode tag characters, U+E0000 to U+E007F. They were designed for flag sequences, such as the flag of England, and they are invisible on their own. Researchers have shown that a hidden run of them can carry instructions into AI chat tools that read the raw characters while the human reader sees nothing. If you paste text from untrusted pages into an AI assistant, or feed it user content, this is one more reason to look at what is really there.
What a zero-width character does to code, forms and search
A zero-width character costs nothing on screen and three bytes in storage, which is exactly why the damage it does is so hard to trace back. Every result below was run while writing this page, on Node 24 and Go 1.27, mostly against the string cas + U+200B + ino.
It is a character, so lengths and comparisons change. In JavaScript 'cas\u200bino'.length is 7, in Go the same string is 9 bytes, === 'casino' is false, and both includes('casino') and Go's strings.Contains return false. A unique index does not stop the second row, a search for the word finds nothing, and the two values sort next to each other looking identical.
Trimming does not remove it. ECMAScript's whitespace list does not include U+200B, so '\u200b'.trim() hands the character straight back. The same list does include U+FEFF, so trim() quietly removes a byte order mark from either end of a string. Go removes neither: unicode.IsSpace(0xFEFF) is false, so strings.TrimSpace keeps the BOM. Two services cleaning the same field therefore disagree, and which one wrote the row decides what you find there.
A \s check does not see it. In JavaScript, /\s/.test('\u200b') is false while /\s/.test('\ufeff') is true. A validator built on \s+ passes the character you cannot see and rejects the BOM, which is the opposite of what most people expect from it.
Numbers fail quietly rather than loudly. Number('1\u200b2') is NaN, which at least shows up. parseInt('1\u200b2', 10) returns 1: a quantity of 12 pasted out of a spreadsheet becomes 1, with no error raised anywhere. For contrast, Number('\ufeff12') is 12, because there the BOM counts as whitespace.
JSON refuses the byte order mark. JSON.parse throws a SyntaxError on a leading U+FEFF and on a trailing U+200B, so a file saved as "UTF-8 with BOM" breaks any parser that reads it as text rather than stripping the mark first.
Compilers notice, sometimes. The Go compiler accepts a byte order mark at the very start of a source file and refuses one anywhere else: invalid BOM in the middle of the file, with the line and column. A zero-width space in the same place is a different story, and that is the hole Trojan Source walks through.
URLs carry the bytes. encodeURIComponent('\u200b') and Go's url.QueryEscape both give %E2%80%8B. A tracking link or a slug that picked one up still looks right in an email client and still resolves to nothing.
Word counts ignore it, character counts do not. A zero-width character is not whitespace, so it never splits a word and the word count stays the same, while every character count goes up by one. When a field with a 160-character limit rejects text that measures 158 in your editor, this is the first thing to check.
How to see zero-width characters
The quickest way is to paste the text into the Invisible Character Detector, which names each hidden character with its code point and count, processed on your device. In VS Code, unicode highlighting draws a box around each invisible character and names it on hover. On a server, grep -nP '[\x{200B}-\x{200D}\x{2060}\x{FEFF}]' file finds every line that contains one.
The full walkthrough of every method, including cat -A, od -c and one-line Python and JavaScript scripts that list exotic characters the detector does not cover, is in how to find invisible Unicode characters.
The same detector names the opposite fault too. When the odd characters are visible and wrong rather than invisible and absent, such as ’ where an apostrophe belongs, nothing is hidden at all: the page is UTF-8 and one layer is reading it as Windows-1252. That one is traced and repaired in weird characters on a website.
When not to strip them
This is the part most cleanup advice skips. Removing every zero-width character is safe only for text that should never contain them in the first place. Keep them in these cases:
- Emoji sequences. A ZWJ between two emoji is part of the emoji. So is a variation selector (U+FE0F) after a heart or a digit.
- Indian scripts. Joiners inside Devanagari, Sinhala, Malayalam and other Brahmic text are spelling. Even Tamil content, which needs them rarely, often sits in the same database column as Hindi or Sinhala text that does.
- Persian, Urdu, Kurdish and other Arabic-script text. The ZWNJ in Persian is part of standard spelling, not an accident.
- Thai, Lao, Khmer and Burmese text. U+200B may be the only word boundary the renderer has.
- Legal and typeset documents. A word joiner or a non-breaking space may be there to keep a section number with its text.
And strip them freely here:
- Identifiers and keys. Usernames, email addresses, SKUs, order references, coupon codes, URLs, API keys.
- Anything you compare or match. Search keys, deduplication keys, blocklists, filters.
- Source code, outside string literals that deliberately contain them, and then written as escapes such as
\u200D, never as the raw character. - The first character of a file. A U+FEFF at the very start is a byte order mark, and most parsers expect it gone.
A practical rule for mixed data: a joiner between two letters, marks or emoji is probably intentional, and a joiner next to a space, a digit, ASCII punctuation or the edge of the string is almost always junk. That rule, written out in JavaScript, Python and Go, is in how to remove hidden characters from text.
Questions people ask
What is a zero-width character?
A real Unicode code point that takes no horizontal room when it is drawn. In practice the group means the five in the table above, and most people fold in the invisible direction marks U+200E and U+200F as well. The important part is that they are characters and not formatting: they are stored, counted, copied, exported and compared exactly like letters.
Is a 0 width space the same as a zero-width space?
Yes. "0 width space", "0-width space" and "zero width space" are three spellings of one character, U+200B, whose Unicode name is ZERO WIDTH SPACE and whose usual abbreviation is ZWSP. There is no separate character behind the digit spelling.
What is a zero-width breaking space?
Almost always U+200B. Its line-breaking class in UAX #14 is named ZW and its stated job is to provide a break opportunity, so the plain zero-width space is the breaking one. The non-breaking member of the family is the word joiner, U+2060, with the older U+FEFF as its retired spelling.
Is the word joiner the same as a non-breaking space?
They do one job each, in different ways. A no-break space, U+00A0, is a visible space that will not break or collapse. A word joiner, U+2060, adds no space at all and only forbids the break, and UAX #14 prohibits a break both before and after it. Use the no-break space where the text needs a gap, such as between a number and its unit, and the word joiner where it must not have one, such as inside a part code.
How do I copy a zero-width joiner?
Use the U+200D box above: its Copy button puts exactly that one character on your clipboard. If an invisible clipboard makes you nervous, write it instead, as ‍ in HTML or \u200d in code. Either way, paste the result into the Invisible Character Detector to confirm what arrived, because nothing on screen will tell you.
Does a zero-width space show up in a character count?
Yes. It is one character, so any count of characters includes it. A word count usually does not change, because the character is not whitespace and does not split a word.
Can a zero-width space break a login or a search?
Yes, and without a word of warning. A username or a password carrying one does not match the same text typed by hand, a search for "casino" does not find "cas" plus U+200B plus "ino", and a deduplication key treats the two spellings as different values. The common way in is innocent: text copied out of a PDF, a chat window or a spreadsheet brings them along.
Should I strip them whenever text arrives?
Normalise at the boundary, field by field, rather than everywhere at once. Identifiers, keys and anything you compare: strip. Free text that may hold emoji, Indic spelling or Persian spelling: keep the joiners and remove only what you can show is junk. The rule for telling those two apart, written out in JavaScript, Python and Go, is in how to remove hidden characters from text.
The takeaway
Zero-width characters are not a bug in Unicode. They are tools for scripts and emoji that need them, which is exactly why a blanket delete is the wrong fix. Find them first, decide per field, and normalise text where it enters your system rather than in a panic after the data is already wrong. If your application keeps collecting this kind of noise from forms and imports, input validation and data clean-up are part of the web application work we take on.
Tools mentioned in this post
- Invisible Character DetectorFind the zero-width spaces, hidden Unicode and look-alike letters in any text, see exactly where they are, and copy a clean version.
- Text Diff CheckerCompare two texts line by line: additions and deletions highlighted.
- Character CounterLive character count with platform limits: tweets, meta descriptions, SMS and more.


