Fix Invisible Characters in Text

Invisible Unicode characters often appear when copying text from modern applications such as documentation sites, messaging tools, and AI systems. These hidden characters can silently break JSON parsing, API requests, database queries, and string comparisons.

Because these characters are invisible, developers frequently spend hours debugging problems that appear to have no visible cause.

Where Invisible Characters Come From

Invisible characters are commonly introduced when copying text from:

  • ChatGPT
  • Slack
  • Notion
  • Microsoft Word
  • Google Docs
  • Documentation websites

Many rich text editors insert Unicode formatting characters that remain hidden when pasted into code.

Why Invisible Characters Break Code

These hidden characters can cause several problems for developers:

  • JSON.parse failures
  • API validation errors
  • Database comparison mismatches
  • Authentication token errors
  • Unexpected string comparison failures

Even though the text looks normal, hidden characters change the actual string data.

Zero Width Space (U+200B)

The zero width space is one of the most common invisible characters. It allows line breaks without adding visible space.

Hello​World

The invisible character between the words is U+200B.

Remove it using JavaScript:


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

Non-Breaking Space (U+00A0)

A non-breaking space looks identical to a normal space but behaves differently in code and HTML.

This character often appears when copying text from Word or websites.


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

Byte Order Mark (U+FEFF)

The Byte Order Mark (BOM) is sometimes added at the beginning of UTF-8 files.

It frequently breaks JSON parsing in JavaScript environments.


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

Zero Width Joiner (U+200D)

The zero width joiner joins characters together without visible spacing. While useful for text formatting, it can cause subtle bugs in code comparisons.

Line Separator (U+2028)

The Unicode line separator is treated differently from a normal newline in JavaScript, which can break JSON parsing and string evaluation.

Automatically Detect Hidden Characters

Instead of manually searching for invisible characters, you can use a dedicated detection tool.

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)
  • Zero Width Joiner (U+200D)
  • Line Separator (U+2028)

The tool runs completely in your browser and does not upload any text.

Unicode Cleaner
ChatGPT Cleaner
JSON Formatter & Cleaner

Related Guides