everythingdeck.

How to Find Hidden Zero-Width and Invisible Characters

6 minutes
Cover illustration for How to Find Hidden Zero-Width and Invisible Characters

Have you ever copied a code snippet or database query that looked completely valid, yet failed with a baffling syntax error like SyntaxError: Invalid or unexpected token? Or searched for a customer name in a database and received zero results even though the text visibly matched?

A hidden or non-printing Unicode character is one possible cause. Some have zero display width, while others resemble ordinary spaces, so the difference can be hard to see.

EverythingDeck’s Unicode Inspector lists code points, UTF-8 bytes, grapheme clusters, and non-printing characters directly in your browser.

Common invisible characters and their codepoints

Unicode contains dozens of whitespace and formatting characters that look identical to a standard ASCII space (U+0020) or take up no visual space at all:

Character Name Codepoint Description & Typical Origin
Zero-Width Space (ZWSP) U+200B Takes up 0 pixels of width. Often copied from rich text editors, PDF documents, or web scrapers.
Non-Breaking Space (NBSP) U+00A0 Standard HTML  . Looks like a space, but prevents automatic line wraps; breaks command-line flags.
Zero-Width Joiner (ZWJ) U+200D Used to combine emoji sequences (e.g., family or profession emojis) and in complex scripts like Sinhala and Devanagari.
Zero-Width Non-Joiner (ZWNJ) U+200C Used in typography to prevent automatic ligatures or character shaping.
Soft Hyphen (SHY) U+00AD Invisible unless a word breaks at the end of a line in print layout engines.
BOM (Byte Order Mark) U+FEFF Can appear at the start of a text file. Some parsers handle it, while others expose it as an unexpected character.

Why invisible characters can cause bugs

  1. Source code parsing: A zero-width space in an unexpected position can produce a syntax or identifier error.
  2. Command-line execution: A non-breaking space (U+00A0) is not the same code point as an ordinary space (U+0020), so pasted commands may be tokenized differently.
  3. Database lookups: Exact string comparisons can fail when one value contains an extra hidden code point.
  4. CSV and JSON parsing: An unexpected character near a delimiter, quote, or at the start of a file can cause a parser error.

How to detect and inspect hidden characters

When troubleshooting suspicious text:

  1. Copy the problematic string and open the Unicode Inspector.
  2. The tool analyzes each character in the string, listing:
    • The visible glyph representation.
    • The official Unicode character name.
    • The hex codepoint (e.g., U+200B).
    • The UTF-8 byte sequence.
    • The general Unicode category (such as Cf for Format or Zs for Space Separator).
  3. Supported zero-width and spacing controls are highlighted in the inspection table.

How to sanitize your text safely

Once you have identified the culprit codepoint:

  • For non-breaking spaces and repeated whitespace, the Text Cleaner can collapse whitespace to ordinary spaces. Review the output because this also changes line and spacing structure.
  • For a zero-width character, use the inspector’s code point table to locate it, then remove that character in your editor.
  • To review a cleaned copy, compare the original and edited strings in the Text Diff Tool.

The inspector processes the entered text in the browser and does not send it to EverythingDeck for analysis.

Search tools, tasks, or file types