Zero-Width Character Decoder: How to Find and Decode Hidden Text

How a zero-width character decoder works, which invisible Unicode characters to look for, and how to decode hidden content step by step and check the result.

Zero-width characters take up no visible space, so a line of text can look normal and still carry extra characters. A zero-width character decoder does two jobs. It shows you where those invisible characters are, and if they follow a known pattern, it converts them back into the hidden message they encode.

What a zero-width character decoder does

The input is ordinary plain text, such as a pasted message, a document excerpt, a username or the contents of a file. The decoder produces one of two kinds of output. Inspection output lists each invisible character with its position and Unicode code point (the unique number that identifies a character, written as U+ followed by hexadecimal digits). Decoding output is a recovered hidden string, which you get only if the text uses an encoding scheme the decoder supports. A decoder reads text. It does not tell you who inserted the characters or why.

Zero-width characters have legitimate uses. They mark line-break opportunities, control how letters join in some writing systems, build emoji sequences and act as file markers. Because they are invisible and often survive copying, people also use them to hide data in text, such as watermarks, tracking fingerprints or secret messages.

Invisible characters you are likely to find

Code point | Name | Typical legitimate use
U+200B | ZERO WIDTH SPACE (ZWSP) | Marks a possible line-break point without showing a space
U+200C | ZERO WIDTH NON-JOINER (ZWNJ) | Stops adjacent letters from joining, for example in Persian and some Indic scripts
U+200D | ZERO WIDTH JOINER (ZWJ) | Joins characters, including multi-part emoji sequences
U+2060 | WORD JOINER (WJ) | Prevents a line break between two characters
U+FEFF | ZERO WIDTH NO-BREAK SPACE | Used as a byte order mark (BOM) at the start of a file

Hidden-message schemes usually pick two or more of these characters as symbols. Some schemes use other invisible characters instead, such as the Unicode tag characters in the range U+E0000 to U+E007F. A decoder that only recognizes the five characters above will miss those.

How hidden content is usually encoded

There is no single standard. A common approach turns the secret message into bytes (often UTF-8) and then into binary digits. Each 0 becomes one zero-width character and each 1 becomes another, and the resulting run is inserted into visible cover text. Many variants exist. Some swap the 0/1 mapping, some put separator characters between letters, some use three or four symbols for a denser encoding, and some encode each character's code point rather than its bytes. A decoder only works if it uses the same scheme as the encoder. If the schemes differ, you get gibberish or nothing.

Example (illustrative only). This example assumes ZWSP means 0, ZWNJ means 1 and each byte is 8 bits. The letter H is byte 0x48, or 01001000 in binary. Hidden after a visible word, it would look like the line below. The bracketed names stand in for the actual characters, which are invisible:

Hello[ZWSP][ZWNJ][ZWSP][ZWSP][ZWNJ][ZWSP][ZWSP][ZWSP]

On screen this displays only as "Hello", but the string contains 13 characters instead of 5. A difference like this between visible length and actual character count is often the first clue.

Step by step: decoding hidden content

  • 1. Get the text with its characters intact. Work from the raw file, an export or a direct copy from the source. Some editors, web forms and messaging platforms strip or normalize invisible characters. If you find nothing, the characters may have been removed in transit, which is different from never having been there.
  • 2. Inspect before decoding. List every invisible character with its position and code point. This shows which characters are present, how many there are and where they sit.
  • 3. Identify the pattern. Count each type. One unbroken run made of two character types, with a total that is a multiple of 8, suggests a binary scheme. Three or more types, or one type repeating at regular intervals, may point to separators or a different base.
  • 4. Decode with a matching mapping. Take only the characters in the run, convert them to bits, group the bits into bytes and decode the bytes as UTF-8.
  • 5. Verify the result. Readable text in a plausible language is a good sign. If the output is garbled, swap the 0/1 mapping, look for separator characters to remove or try a different bit grouping. Write down the mapping that worked so you can reproduce it.
  • 6. Work on a copy. Keep the original text unchanged so you can repeat the inspection or try another scheme.

The Python snippets below illustrate steps 2 and 4. They have not been tested here against any specific encoding tool, so adjust the mapping to match the pattern you found. The file is opened as utf-8 rather than utf-8-sig, so a leading byte order mark stays in the text and appears in the inspection output.

ZERO_WIDTH = {
    "\u200b": "ZWSP",
    "\u200c": "ZWNJ",
    "\u200d": "ZWJ",
    "\u2060": "WJ",
    "\ufeff": "ZWNBSP/BOM",
}

with open("sample.txt", encoding="utf-8") as f:
    text = f.read()

for i, ch in enumerate(text):
    if ch in ZERO_WIDTH or 0xE0000 <= ord(ch) <= 0xE007F:
        name = ZERO_WIDTH.get(ch, "TAG")
        print(i, f"U+{ord(ch):04X}", name)
def decode_binary(text, zero="\u200b", one="\u200c"):
    bits = "".join("0" if ch == zero else "1"
                   for ch in text if ch in (zero, one))
    usable = len(bits) - len(bits) % 8
    data = bytes(int(bits[i:i + 8], 2) for i in range(0, usable, 8))
    return data.decode("utf-8", errors="replace")

print(decode_binary(text))
# If the output is unreadable, try the reverse mapping:
print(decode_binary(text, zero="\u200c", one="\u200b"))

The decode function collects every matching character in the text it receives, including any that were there for legitimate reasons. Pass it only the run you identified in step 3. The errors="replace" setting swaps invalid byte sequences for the replacement character U+FFFD (shown as �). Many of these in the output usually mean the mapping or the grouping is wrong.

Removing zero-width characters without breaking meaningful text

After decoding, you may want to clean the text. Do not strip every zero-width character at once. A ZWJ inside an emoji sequence holds the combined emoji together, and a ZWNJ in Persian or an Indic script changes how letters connect. Some tools also expect a byte order mark at the very start of a file. Remove only the run you identified as the hidden payload, or limit the removal to characters outside these contexts. Then check the result:

  • The visible text looks exactly the same as before.
  • The character count dropped by exactly the number of characters you meant to remove.
  • Combined emoji still display as a single symbol.
  • Text in joining scripts still connects the way it did before.

Limits and gaps

A decoder can reveal invisible characters and apply a scheme you already know. It cannot reliably identify an unknown scheme, and it cannot confirm who added the characters or why. If the hidden data was encrypted before encoding, decoding gives you only ciphertext. This guide does not compare or evaluate specific online or desktop decoders, because no tested information about them was available. For sensitive text, a local script like the examples above avoids pasting the content into a third-party service.