Remove Zero Width Space (U+200B)

A zero width space (U+200B) is an invisible Unicode character used for text formatting and word breaking. Although it cannot be seen, it can cause serious issues in code, APIs, and data processing systems.

What Is a Zero Width Space?

A zero width space is a special Unicode character that allows line breaks without adding visible spacing. It is often inserted automatically by text editors, messaging platforms, or content management systems.

Because the character is invisible, developers often do not realize it exists in their text.

Why Zero Width Spaces Appear

Zero width spaces commonly appear when copying and pasting text from:

  • Slack
  • Microsoft Word
  • Notion
  • ChatGPT
  • Google Docs
  • Rich text editors

These tools sometimes insert hidden formatting characters to control line wrapping or layout.

Why Zero Width Spaces Break Code

Invisible characters can break many systems that expect strict formatting.

  • JSON parsing failures
  • API request validation errors
  • Unexpected string mismatches
  • Database comparison bugs
  • Authentication token errors

Because the character is invisible, debugging the problem can be extremely frustrating.

Example

Hello​World

The text above looks normal, but there is actually a hidden character between the two words. That invisible character is U+200B Zero Width Space.

Remove Zero Width Space in JavaScript

You can remove zero width spaces using a simple JavaScript replacement:


text.replace(/\u200B/g, "")

This removes all instances of the hidden character from the string.

Use a Unicode Cleaner Tool

Instead of manually searching for invisible characters, you can use an automated cleaner.

Unicode Cleaner detects and removes hidden Unicode characters such as:

  • Zero Width Space (U+200B)
  • Non-Breaking Space (U+00A0)
  • Byte Order Mark (U+FEFF)
  • Other invisible Unicode characters

The tool runs entirely in your browser and helps quickly debug invisible character problems.

Unicode Cleaner
ChatGPT Cleaner
JSON Formatter & Cleaner

Related Guides