Zero Width Non Joiner (ZWNJ): Uses, Typing and Removal
The zero width non joiner, or ZWNJ, is the invisible character U+200C. It tells two neighbouring letters not to connect. In Persian and some Indian scripts it is a normal part of spelling, and in English text it is almost always an accident. That split decides what to do about it: keep it where it belongs, remove it where it does not. This guide covers what it is, where it comes from, how to find it, and how to clean a text without breaking the languages that need it.
What is the zero width non joiner?
The zero width non joiner is a format character. It has no width and draws nothing. Its only job is to break a connection between the characters on either side of it. The character that does the opposite, the zero-width joiner, is explained alongside it in our guide to the ZWJ and ZWNJ; this guide concentrates on the non-joiner and on what to do with it.
| Fact | Value |
|---|---|
| Name | ZERO WIDTH NON-JOINER, short form ZWNJ |
| Code point | U+200C, decimal 8204 |
| Unicode category | Format character (Cf) |
| UTF-8 bytes | E2 80 8C |
| HTML | ‌, ‌ or ‌ |
| In code | "\u200c" in Python, "\u200c" in JavaScript |
It is not the same as the zero-width space, U+200B, which marks a place where a line may break. The non-joiner is about letter shapes, not line breaks.
Where the ZWNJ is correct
In Persian, many words are built from parts that belong to one word but must not be joined in writing. Persian is written in a cursive script, so letters would connect by default. A ZWNJ keeps them apart without adding the wider gap of a space. Persian speakers call it the half-space. It appears in verb forms such as میروم (I go) and in plurals such as خانهها (houses). Take the ZWNJ out and the word is misspelled: the parts either fuse together or, if a space is typed, look like two words.
In Devanagari, the script of Hindi, a ZWNJ placed after the virama sign stops two consonants from merging into a conjunct. Related scripts of South Asia use the same trick. The details and a sequence table are in the ZWJ and ZWNJ guide.
Where the ZWNJ turns up by accident
- Copy and paste from web pages and documents in other languages, where it was valid, into English text, where it is not.
- Chat apps and text editors that insert or keep it when a message is formatted or converted.
- Exports and imports between systems that handle format characters differently.
Because it draws nothing, nobody notices it until a symptom appears: a word that search cannot find, two strings that look equal and are not, or a character count that is one too high. Zero-width characters can also be used on purpose to hide a few bits of data inside text, which is one more reason to clean text from sources you do not trust.
One programming detail catches people out: in JavaScript, both the ZWNJ and the ZWJ are allowed inside identifiers after the first character. A variable name pasted from a web page can contain one and still be valid code, which makes it very hard to spot.
Should you remove it?
| Your text | Remove the ZWNJ? | Why |
|---|---|---|
| English or other Latin-script text | Yes | It carries no meaning there and causes mismatches |
| Persian text | No | It is part of correct spelling |
| Hindi, Bengali, Sinhala and similar scripts | No | It chooses letter forms |
| Code, file names, identifiers | Yes | It hides in names and breaks matching |
| Data going into a database or search index | Usually | For Latin text, yes. For Persian or Hindi fields, keep it and search with it in mind |
How to find it
- Use the cleaner. Paste the text into the AI Text Cleaner. The list titled Characters found in your text shows "zero-width non-joiner" with a count.
- Use a spreadsheet. This counts the ZWNJ characters in cell A1:
=LEN(A1) - LEN(SUBSTITUTE(A1, UNICHAR(8204), "")). - Use Python. This prints each position:
[i for i, ch in enumerate(text) if ch == "\u200c"]. - Use the command line. This prints each matching line with its line number:
perl -CSD -ne 'print "$.: $_" if /\x{200C}/' file.txt.
How to type it
- Persian keyboards have a way to type it; the key or combination depends on the layout, so look in your keyboard's documentation.
- In HTML, write
‌. - In Microsoft Word on Windows, type
200Cand pressAlt+X. - On phones, many Persian and Hindi keyboards put it on the symbols page.
How to remove it and keep everything else
The cleaner's Remove invisible characters option deletes a ZWNJ everywhere except directly between two emoji. It does not look at the language of the text. That is the right result for English and the wrong one for Persian. The same option also removes direction marks, which Persian text sometimes needs.
For Persian or Hindi text, do this instead:
- Switch off Remove invisible characters.
- Keep Replace unusual spaces on. It works on its own and does not touch the ZWNJ.
- Remove only the unwanted characters with your own pattern, which leaves ZWNJ in place:
import re
# remove zero-width space, word joiner, byte order mark and soft hyphen
text = re.sub("[\u200b\u2060\ufeff\u00ad]", "", text)
To remove the ZWNJ itself from English text without the cleaner:
# Python
text = text.replace("\u200c", "")
// JavaScript
text = text.replace(/\u200c/g, "");
In a spreadsheet: =SUBSTITUTE(A1, UNICHAR(8204), "").
Common mistakes
- Replacing it with a space. In Persian, a space turns one word into two. The ZWNJ was the right character.
- Stripping every format character in a pipeline. A generic "remove invisible characters" step silently damages Persian and Indian-script text.
- Assuming Unicode normalization will remove it. Normalization forms do not delete a ZWNJ. The cleaner's NFC option leaves it alone.
- Confusing it with the zero-width space. They have different codes and different jobs. The space is covered in what is a zero-width space.
Quick answers
Is the ZWNJ visible? No. It has no width. Some editors can show it with a marker; the cleaner lists it by name.
Does it count as a character? Yes. Its length is 1 in Python and JavaScript, so it raises a character count by one.
Is it a space? No. White-space checks such as trim do not remove it.