Unicode for Invisible Characters: How to Find, Identify and Safely Handle Them

Learn which Unicode characters are invisible, how inspection tools reveal them, how to find them step by step, and how to clean text without breaking meaning.

An invisible character in Unicode is a character that takes up no visible space, or looks exactly like an ordinary space, but is still stored in the text. These characters can break searches, password checks, spreadsheet lookups and source code while looking perfectly normal on screen. This guide covers which characters are involved, what an inspection tool does with your text, how to find hidden characters step by step, and how to confirm that a cleanup didn't change meaningful content.

What counts as an invisible character

There is no single invisible character in Unicode. Several groups of characters can appear invisible. Each character has a code point, a unique number written as U+ followed by hexadecimal digits, such as U+200B. Each also has a general category, which is a short label describing its role.

  • Zero-width format characters (category Cf, meaning format) affect joining, line breaking or text direction but draw nothing, for example U+200B ZERO WIDTH SPACE.
  • Space characters other than the ordinary space U+0020 (category Zs) look blank but compare as different characters, for example U+00A0 NO-BREAK SPACE.
  • Line and paragraph separators (categories Zl and Zp) are U+2028 and U+2029.
  • Characters that are technically letters or symbols but are drawn blank include U+3164 HANGUL FILLER (category Lo) and U+2800 BRAILLE PATTERN BLANK (category So).

Whether a character actually looks invisible also depends on the font and the application. Some editors show zero-width characters as small markers, and others show nothing at all.

Common invisible characters at a glance

Code point | Name | UTF-8 bytes | Where it typically comes from | Usually safe to remove?
U+200B | ZERO WIDTH SPACE | E2 80 8B | Copied web text, line-break hints | Often, but it can mark break points in scripts written without spaces, such as Thai or Khmer
U+200C | ZERO WIDTH NON-JOINER | E2 80 8C | Persian, Indic and other scripts | No, it often controls how letters are shaped
U+200D | ZERO WIDTH JOINER | E2 80 8D | Emoji sequences, Indic scripts | No, not inside emoji or script text
U+2060 | WORD JOINER | E2 81 A0 | Used to prevent a line break | Depends on intent
U+FEFF | ZERO WIDTH NO-BREAK SPACE / byte order mark | EF BB BF | Start of files saved by some editors | At the start of a file, only if the consuming tool rejects it; in the middle of text it is usually a stray
U+00A0 | NO-BREAK SPACE | C2 A0 | Word processors, HTML   | Replace with a normal space only if the non-breaking behavior isn't wanted
U+00AD | SOFT HYPHEN | C2 AD | Hyphenation hints | Usually, unless the hyphenation hints are wanted
U+200E / U+200F | LEFT-TO-RIGHT MARK / RIGHT-TO-LEFT MARK | E2 80 8E / E2 80 8F | Mixed right-to-left and left-to-right text | Not in genuine bidirectional text
U+202A–U+202E, U+2066–U+2069 | Bidirectional embedding, override and isolate controls | E2 80 AA–E2 80 AE, E2 81 A6–E2 81 A9 | Bidirectional text; sometimes abuse in code | Review each one
U+3164 | HANGUL FILLER | E3 85 A4 | Blank-looking names and messages | Depends on context
U+2800 | BRAILLE PATTERN BLANK | E2 A0 80 | Blank-looking names and messages | Depends on context

The UTF-8 bytes column shows how each character is stored in a UTF-8 file. These byte values are what you will see in a hex dump. Learning a few of them, such as E2 80 8B for a zero-width space, makes raw output much easier to read.

What an invisible-character inspector does for your text

An inspection tool takes a pasted string or a file and lists the characters it actually contains. A typical tool reports each character's position, code point, official name and category, and it highlights the ones that render as blank. Inspection on its own only reads the text. Your text should change only when you choose a separate cleanup action, such as remove or replace.

Scope matters. A tool finds only the characters it is set up to look for. A tool that checks only format characters (Cf) will miss U+3164 and U+2800, because those belong to letter and symbol categories. A tool that flags every non-ASCII character will also flag legitimate accented letters and emoji. No specific product was tested for this guide, so check your tool's documentation for which ranges it covers and whether any action modifies the input.

Step by step: finding hidden characters

  • 1. Copy the exact text from its source instead of retyping it, because retyping removes the problem you are trying to see.
  • 2. Look for a quick sign of hidden characters: a length that is larger than the visible characters suggest, two strings that look identical but don't match, or a cursor that needs an extra arrow-key press to move past a spot.
  • 3. Scan the text with an inspector, a short script, or a command-line tool (options below).
  • 4. For each hit, write down the position, code point and name.
  • 5. Decide whether to keep, remove or replace each character, based on its context (see Deciding what to remove).
  • 6. Clean the text, then verify the result.

Option 1: Python script

import unicodedata

SUSPECT_CATEGORIES = {"Cf", "Zs", "Zl", "Zp"}
BLANK_LOOKING = {"\u115f", "\u3164", "\u2800"}

text = "pass\u200bword"  # example input with a hidden zero-width space

for i, ch in enumerate(text):
    cat = unicodedata.category(ch)
    if (cat in SUSPECT_CATEGORIES and ch != " ") or ch in BLANK_LOOKING:
        print(i, f"U+{ord(ch):04X}", unicodedata.name(ch, "<unnamed>"), cat)

This is an illustrative example and was not run for this guide. For the sample input, it should print one line reporting position 4, U+200B, ZERO WIDTH SPACE and category Cf. The ordinary space is excluded so normal sentences don't flood the output. The extra BLANK_LOOKING set catches filler characters that a category check alone would miss.

Option 2: JavaScript in a browser console

const text = "pass\u200Bword"; // example input
[...text].forEach((ch, i) => {
  if (/[\p{Cf}\p{Zs}\p{Zl}\p{Zp}\u115F\u3164\u2800]/u.test(ch) && ch !== " ") {
    const cp = ch.codePointAt(0).toString(16).toUpperCase().padStart(4, "0");
    console.log(i, "U+" + cp);
  }
});

The u flag enables Unicode property escapes such as \p{Cf}. Spreading the string with [...text] steps through it by code point rather than by UTF-16 unit, so the reported index counts characters as a person would.

Option 3: Command line

# Show the raw bytes of a short sample
printf 'a\u200bb' | od -An -tx1

# List lines in a file that contain common zero-width characters or no-break spaces
grep -nP '[\x{200B}-\x{200D}\x{2060}\x{FEFF}\x{00A0}]' file.txt

For the od command, the expected bytes are 61 e2 80 8b 62. The letters a and b surround the three bytes of U+200B. These commands assume a UTF-8 locale. The \u escape in printf requires a printf that supports it, such as the bash builtin in recent versions. grep -P needs GNU grep built with Perl-compatible regex support. If either is unavailable, search for the byte sequences from the table instead. For a quick visual check, cat -A shows non-ASCII bytes as M- sequences, but it doesn't name the characters.

Deciding what to remove

Stripping every invisible character can damage text. Before removing anything, check whether one of these cases applies:

  • Emoji: the zero width joiner combines several emoji into one, such as a family or a profession emoji. Removing it splits the emoji into separate pictures.
  • Scripts like Persian and many Indic languages: the zero width non-joiner and joiner control letter shaping. Removing them changes how words are written.
  • Thai, Khmer and similar scripts: a zero-width space may mark where a line is allowed to break.
  • No-break spaces: these may be intentional, for example to keep a number and its unit on the same line.
  • Byte order mark: at the very start of a file, some tools expect it and others reject it.
  • Right-to-left text: direction marks and isolates may be needed for correct display.

Removal is usually the right choice in identifiers, usernames, passwords, URLs, email fields, spreadsheet keys, CSV headers and source code outside string literals. In source code, give bidirectional control characters special attention. Researchers have shown, in work publicized as Trojan Source, that these controls can make code display in a different order than the compiler reads it.

Verifying the result

  • Run the same scan again. It should return no hits for the characters you targeted.
  • Compare character counts before and after. The difference should equal the number of characters you meant to remove.
  • Compare the visible text side by side. It should look identical. If an emoji split apart or letter shapes changed, a meaningful character was removed.
  • Repeat the operation that originally failed, such as the search, lookup, login or compile, and confirm it now works.

If you need an invisible character rather than wanting to remove one

Some people search for an invisible character to fill a field that cannot be left empty or to create blank spacing. U+200B, U+3164 and U+2800 are commonly tried for this. Many platforms strip, normalize or reject such characters, and screen readers may announce them unpredictably. No platform-specific evidence was available for this guide, so test on the target service before relying on any of them. For layout spacing in documents or web pages, a no-break space or the formatting tools of the editor are more predictable choices.