Zero-Width Character Remover & AI Text Cleaner

Paste text copied from ChatGPT, Gemini, or Claude and instantly strip invisible "ghost" characters — zero-width spaces, non-breaking spaces, and hidden Unicode artifacts that break code and confuse parsers.

Your text never leaves your browser — all processing is client-side. Safe for code containing API keys or credentials.
Paste text to scan for ghost characters
Input — paste your AI text here
Cleaned output

Characters found

No ghost characters detected yet.

Why does text from AI chatbots break my code?

AI models like ChatGPT, Gemini, and Claude are trained on internet text that contains all kinds of Unicode. When generating a response, they sometimes include invisible formatting characters — Zero-Width Spaces (U+200B), Non-Breaking Spaces (U+00A0), or Byte Order Marks (U+FEFF) — that look like nothing in a chat window.

The moment you paste that text into an IDE, compiler, Python interpreter, or YAML parser, those ghost characters are treated as real input. The result: syntax errors on lines that look perfectly fine, broken indentation, or JSON that your parser rejects.

Which ghost characters cause the most problems?

  • U+200B Zero-Width Space — the most common AI artifact. Causes SyntaxError: Illegal character in JavaScript and TypeScript.
  • U+00A0 Non-Breaking Space — visually identical to a space. Breaks Python indentation and YAML parsing.
  • U+FEFF BOM — Byte Order Mark inserted at file or string boundaries. Breaks JSON parsers and shell scripts.
  • U+200C/200D ZWNJ/ZWJ — Non-Joiner and Joiner used in script rendering. Appear in AI output as accidental inclusions.
  • U+202F Narrow No-Break Space — looks like a thin space, breaks string comparisons and numeric parsing.

Common IDE errors caused by invisible characters

If you are searching for one of these error messages, it is likely caused by a ghost character in code pasted from an AI chatbot.

SyntaxError: Invalid or unexpected token
JavaScript / TypeScript — caused by U+200B or U+FEFF inside a string literal or identifier.
JS / TS
SyntaxError: Illegal character '\u200b'
Node.js — zero-width space directly reported in the error when encountered inside source code.
Node.js
IndentationError: unexpected indent
Python — a Non-Breaking Space (U+00A0) in the indentation looks correct visually but is not accepted as whitespace by the interpreter.
Python
TabError: inconsistent use of tabs and spaces in indentation
Python — narrow no-break spaces or zero-width spaces mixed into tab-based indentation.
Python
error: stray '\302' in program  /  error: stray '\240' in program
C / C++ — the UTF-8 encoding of U+00A0 (Non-Breaking Space) is 0xC2 0xA0 (octal \302 \240), which GCC reports as stray bytes.
C / C++
could not find expected ':'  /  mapping values are not allowed here
YAML — a Non-Breaking Space instead of a regular space before a colon or in indentation breaks the YAML parser.
YAML
JSONDecodeError: Expecting value: line X column Y (char Z)
Python / JSON — a BOM (U+FEFF) at the start of a JSON string, or a zero-width space inside a key or value, causes the parser to fail.
JSON
bash: command not found  /  unexpected token
Bash / Shell — a zero-width space or non-breaking space inside a command name or variable makes the shell unable to find the command.
Bash

Frequently Asked Questions

Why does text from ChatGPT break my code?

AI models like ChatGPT, Gemini, and Claude sometimes include invisible Unicode characters — Zero-Width Spaces (U+200B), Non-Breaking Spaces (U+00A0), or Byte Order Marks. These look like nothing in a chat window but are real characters that IDEs and parsers treat as illegal input, producing syntax errors on lines that appear perfectly clean.

What is a zero-width space (U+200B)?

A Zero-Width Space is an invisible Unicode character with no visual width, historically used as a word-break hint in languages without spaces. AI models occasionally include them in generated code. In an IDE they appear as SyntaxError: Illegal character '\u200b' or similar "Invalid token" errors.

What is a non-breaking space and why does it cause errors?

A Non-Breaking Space (U+00A0) looks identical to a regular space (U+0020) in most text editors and web browsers, but is a different Unicode character. Python, YAML parsers, and most compilers only accept the regular space as whitespace — so code that looks correctly indented will throw IndentationError or unexpected token errors.

Which invisible characters does this tool remove?

The tool detects and removes: Zero-Width Space (U+200B), Zero-Width Non-Joiner (U+200C), Zero-Width Joiner (U+200D), Left-to-Right Mark (U+200E), Right-to-Left Mark (U+200F), BOM / Zero-Width No-Break Space (U+FEFF), Non-Breaking Space (U+00A0), Soft Hyphen (U+00AD), Word Joiner (U+2060), Narrow No-Break Space (U+202F), and Line / Paragraph Separators (U+2028, U+2029).

Does this tool send my text to a server?

No. All detection and removal happens entirely in your browser using JavaScript. Your text is never uploaded, transmitted, or stored. This makes it safe to paste code containing API keys, credentials, or proprietary logic.

How do I find invisible characters in VS Code?

Open Find (Ctrl+F / Cmd+F), enable regex mode, and search for [\u200B\u200C\u200D\u200E\u200F\uFEFF\u00A0\u00AD\u202F\u2060\u2028\u2029]. VS Code will highlight every match. Or paste your text into this tool and click Clean & Copy — it's faster.

How do I remove zero-width spaces in Python?

Use regex: import re; cleaned = re.sub('[\u200b-\u200f\ufeff\u00a0\u00ad\u202f\u2060\u2028\u2029]', '', text). This tool does the same thing in your browser without any code or installation needed.

What does the "Reveal ghost chars" button do?

It switches the input pane into a visual mode that highlights every ghost character as a small red badge showing the Unicode label (e.g., ZWSP, NBSP). This lets you see exactly which lines and positions the hidden characters are in before you clean them.