What Is a Zero Width Space (U+200B)?

A Zero Width Space (U+200B) is an invisible Unicode character used to indicate potential line break opportunities within text. It has no visual width, produces no visible symbol, and cannot be detected through normal visual inspection — yet it can break JSON parsing, authentication systems, form validation, and database queries.

Zero Width Space Technical Definition

  • Name: Zero Width Space
  • Unicode Code Point: U+200B
  • Category: Format Character (Cf)
  • Visible Width: 0
  • UTF-8 Encoding: E2 80 8B

Unlike a regular space (U+0020), U+200B does not create spacing. It only signals where a line break is allowed.

Why Zero Width Spaces Exist

Zero width spaces are primarily used in typography and web rendering. They help browsers wrap long strings — such as URLs or continuous characters — without adding visible breaks.

Modern systems that commonly insert U+200B include:

  • Rich text editors
  • Google Docs
  • Microsoft Word
  • PDF copy-paste
  • ChatGPT and other AI interfaces
  • Messaging apps

The problem arises when that hidden character is copied into raw code or structured data.

How U+200B Breaks JSON and Code

JSON is extremely strict. Only four whitespace characters are allowed:

  • U+0020 (Space)
  • U+0009 (Tab)
  • U+000A (Line Feed)
  • U+000D (Carriage Return)

Zero Width Space (U+200B) is not allowed. If it appears between tokens, JSON.parse() throws:

SyntaxError: Unexpected token

Example of a Broken JSON Key

{
  "user​name": "admin"
}

The key visually reads as username, but it actually contains:

u s e r \u200B n a m e

That makes string comparisons fail silently.

How to Detect Zero Width Space

Most editors do not display it. However, you can detect it programmatically:

const hasZWSP = /\u200B/.test(inputString);

Or remove it safely:

const cleaned = inputString.replace(/\u200B/g, '');

How to Remove Zero Width Space Safely

For quick cleanup, use a dedicated tool:

All tools operate 100% client-side. No data is uploaded.

Why Developers Should Care

Zero width spaces cause:

  • Authentication failures
  • API signature mismatches
  • JSON parsing errors
  • Form validation bugs
  • Database query mismatches
  • Invisible string comparison failures

Because the character is invisible, debugging becomes extremely time-consuming.

Zero Width Space vs Regular Space

Regular Space (U+0020):

  • Visible spacing
  • Allowed in JSON
  • Standard ASCII

Zero Width Space (U+200B):

  • Invisible
  • Not allowed in JSON structural whitespace
  • Unicode-only character

Conclusion

Zero Width Space (U+200B) is a legitimate Unicode formatting character — but in development workflows, it often becomes a hidden bug. When copying text from rich interfaces or AI tools, invisible format characters may enter your codebase silently.

Understanding how U+200B works — and how to remove it — prevents hours of debugging and protects your data integrity.