Find Unicode and hidden characters in text

How to find hidden and special Unicode characters in text, read them as grapheme clusters, and decide what is safe to remove without changing meaning.

Text that looks ordinary can contain characters you cannot see: zero-width spaces, direction controls, variation selectors, non-breaking spaces, or letters from another script that look identical to Latin ones. They can break a search, make two identical-looking strings unequal, reorder what a reader sees, or hold an emoji or a word in some scripts together. This review covers how inspection works, what it does and does not change, and when removing what it finds is safe.

Is inspecting and cleaning hidden characters right for your use?

Inspection is almost always worth doing. It only reports which characters are present and changes nothing. Cleaning, meaning removing or replacing what inspection finds, is where the risk lies. The benefit of cleaning is predictable text that matches, sorts and compares the way it looks. The cost is that some invisible characters carry meaning, and removing them silently damages the text.

  • Cleaning to plain text is usually appropriate for identifiers, usernames, URLs, file names, source code, data fields, search keys and anything compared by exact match.
  • Cleaning should be selective, or skipped, for natural-language text in scripts that rely on joiner and non-joiner characters (for example Persian, Arabic and several Indic scripts), for text containing emoji sequences, and for mixed left-to-right and right-to-left content where direction marks were added on purpose.
  • If you only need to know why two strings differ or why a search fails, inspect and leave the original unchanged.

What a hidden-character inspector actually shows

Stored text is a sequence of Unicode code points, each written as U+ followed by a hexadecimal number. What you see is the font and layout engine's rendering of that sequence. An inspector shows the stored layer: each code point, its official name and its general category. That is how you separate what is in the text from how it is displayed. Some characters render as nothing, some change how neighboring characters are drawn, and some only change display order.

Code points are not the same as what a reader thinks of as one character. Unicode Standard Annex #29 defines extended grapheme clusters, the units a user perceives as single characters. One cluster can contain several code points, including invisible ones. A useful inspector, or a careful script, groups code points into clusters so you can see which invisible characters belong to a visible character and which are stray.

Common hidden and look-alike characters

Code point | Name | Why it matters
U+200B | ZERO WIDTH SPACE | Invisible; splits words for exact-match search and comparison
U+200C | ZERO WIDTH NON-JOINER | Prevents letters joining; meaningful in Persian and some Indic text
U+200D | ZERO WIDTH JOINER | Joins emoji into sequences and affects shaping in some scripts
U+2060 | WORD JOINER | Invisible; prevents a line break
U+FEFF | ZERO WIDTH NO-BREAK SPACE (byte order mark) | Often left at the start of files; can break parsers and comparisons
U+00AD | SOFT HYPHEN | Usually invisible; shows only at a line break
U+00A0 | NO-BREAK SPACE | Looks like a space but is a different code point
U+200E, U+200F | LEFT-TO-RIGHT MARK, RIGHT-TO-LEFT MARK | Invisible; influence bidirectional display order
U+202A to U+202E | Bidirectional embedding and override controls | Can reorder displayed text; U+202E forces right-to-left display
U+2066 to U+2069 | Bidirectional isolate controls | Isolate a run of text's direction
U+FE0E, U+FE0F | VARIATION SELECTOR-15, VARIATION SELECTOR-16 | Request text or emoji presentation of the preceding character
U+E0020 to U+E007F | Tag characters | Invisible; used in some flag emoji sequences
U+0430 | CYRILLIC SMALL LETTER A | Looks like Latin a (U+0061) but is a different character

Filtering by general category catches many of these but not all. The format category, Cf, includes zero-width spaces and joiners, direction marks and controls, the byte order mark, the soft hyphen, the word joiner and tag characters. Variation selectors are nonspacing marks (Mn), the no-break space is a space separator (Zs), and look-alike letters are ordinary letters. They need their own checks.

Inspection versus normalization versus visual effects

Several operations get described loosely as finding or fixing Unicode, and they differ.

  • Inspection lists code points and names. The stored text is unchanged.
  • Stripping deletes selected code points. The stored text changes, and so can meaning.
  • Normalization rewrites text into a standard form. NFC and NFD switch between precomposed and decomposed forms of the same character, such as U+00E9 versus U+0065 followed by U+0301. NFKC and NFKD also fold compatibility characters. For example, the styled letters in the Mathematical Alphanumeric Symbols block become plain letters, which removes the bold or script 'font' look. Normalization does not remove zero-width or direction characters.
  • Bidirectional controls and CSS direction settings change display order without changing letter order in storage. An inspector shows the true stored order. This is the mechanism behind the Trojan Source class of source-code attacks, a useful search term if you review code.

Why grapheme boundaries matter: a reversal check

Reversing text is a clear test of whether a tool respects grapheme clusters. Take a decomposed é, stored as U+0065 then U+0301 (COMBINING ACUTE ACCENT). Reverse it code point by code point and the accent comes first, so it attaches to whatever precedes it or displays on its own. Take the family emoji built from U+1F468, U+200D, U+1F469, U+200D, U+1F467. Reverse it by code point and the sequence falls apart into separate people and stray joiners. Flags made of two regional indicator symbols, such as U+1F1FA U+1F1F8, can turn into a different flag or two unpaired letters. A tool that reverses, truncates or counts by grapheme cluster keeps all three intact. A tool that works by code point, or by UTF-16 unit, does not.

The same check applies to inspection. A zero-width joiner inside an emoji sequence belongs there. One between two Latin letters almost certainly does not. Grouping by cluster makes the difference visible.

How to find Unicode characters in text yourself

Useful search terms for ready-made tools are 'Unicode inspector', 'code point viewer', 'show invisible characters', 'zero-width character detector' and 'bidi control checker'. Many code editors have a setting to render whitespace or invisible and ambiguous Unicode characters. Its name and location differ between editors and versions, so check your editor's own documentation. No specific tool was tested for this article. Do not assume any web-based inspector's privacy or data handling from how it looks. For sensitive text, a local script is the safer choice.

Python's standard unicodedata module lists every code point with its category and name:

import unicodedata

text = "pass\u200bword"
for i, ch in enumerate(text):
    cp = f"U+{ord(ch):04X}"
    cat = unicodedata.category(ch)
    name = unicodedata.name(ch, "<unnamed>")
    print(i, cp, cat, name)

Position 4 in this example reports U+200B, category Cf, ZERO WIDTH SPACE: the character that keeps the string from matching a search for the plain word.

To group code points into grapheme clusters, JavaScript environments that support Intl.Segmenter can segment by grapheme:

const text = "e\u0301\u{1F468}\u200D\u{1F469}\u200D\u{1F467}";
const seg = new Intl.Segmenter("en", { granularity: "grapheme" });

for (const { segment } of seg.segment(text)) {
  const cps = [...segment].map(c =>
    "U+" + c.codePointAt(0).toString(16).toUpperCase().padStart(4, "0"));
  console.log(segment, cps.join(" "));
}

Where grapheme segmentation follows current Unicode rules, this prints two clusters: the accented e with its two code points, and the family emoji with its five, joiners included. Older runtimes may lack Intl.Segmenter or follow older segmentation rules, so confirm in the environment you actually use.

Will cleaned or uncleaned text survive copying and sharing?

Hidden characters are part of the stored text, so they generally travel with ordinary copy and paste. That persistence is why they cause trouble in places you did not expect. Some applications normalize, convert or strip certain characters on paste or save, such as turning no-break spaces into regular spaces, but behavior differs by application and version. No destination-specific tests were available for this article. Check the actual destination by pasting a known sample and inspecting the result, and do not generalize one successful paste to other apps.

  • Search and matching: an invisible character inside a word can stop exact-match search, filters and deduplication from finding it, while the text looks correct to a human.
  • Editing: cursor movement and deletion may step over invisible characters unexpectedly, and deleting one cluster can leave a stray joiner or combining mark behind.
  • Reading order: direction controls can make the displayed order differ from the stored order, which affects anyone copying the text and any tool that processes it.
  • Assistive technology: how screen readers handle invisible characters, direction controls and look-alike letters varies by product and settings. No documentation or scoped tests were available here, so test with the specific assistive technology your readers use. Styled mathematical letters, unlike plain letters, are a known compatibility concern for screen reading and search.
  • Plain-text equivalent: where text must be searchable, compared, used as an identifier or read aloud reliably, keep or provide a cleaned plain-text version alongside any decorated or direction-controlled one.

A cautious cleaning workflow

  • Inspect first and keep the original.
  • Group code points into grapheme clusters, so joiners and marks inside emoji or words are not mistaken for stray characters.
  • Remove only characters you have a reason to remove for the intended use, such as a leading byte order mark or zero-width spaces in an identifier, rather than deleting the whole format category.
  • Normalize to NFC for most storage and comparison. Choose NFKC only when you deliberately want styled and compatibility characters folded to plain ones.
  • Check separately for look-alike letters from other scripts where spoofing matters.
  • Re-inspect the result in the destination where it will actually be used.

Gaps in this review

No specific inspector tools, editors, platforms or screen readers were tested for this article, and no measurements were available. Statements about character names, categories, normalization forms and grapheme segmentation follow the Unicode Standard. Statements about copy, paste and assistive technology behavior describe general mechanisms and should be confirmed in the specific environment you rely on.