Skip to content
9 min readUpdated 29 October 2026

Zero-Width Space: Uses, Detection and Safe Removal

Understand U+200B, why it can interrupt copying and search, and how to remove unwanted instances while preserving legitimate multilingual text.

A zero width space is the Unicode character U+200B. It takes up three bytes in UTF-8 and has no visible width, which is why copied text can look fine on screen and still break search, matching or layout.

It often turns up after copying from a website, a CMS or a chat interface. The text looks normal, then one field won't match, a URL won't validate, or a column shifts for no obvious reason. Moving through a document quickly helps you locate the bad spot, and this guide to document search shortcuts covers the basics.

A frustrated person looking at a computer screen showing no results found for an invisible character search.

Table of Contents

The invisible character that breaks your copy and paste

The bug shows up in dull places. You paste a product name into a search field and it won't match the same text in your spreadsheet. A URL looks clean in your editor, but the link checker treats it as a different string. Both are the zero width space problem: an invisible character with a real code point and real consequences.

Zero width space is U+200B, a Unicode character with no visible width that still exists in the text and takes three bytes in UTF-8 (Wikipedia). Software sees it even when you can't. It isn't a typo or a rendering glitch.

A stray ZWSP in copied text is routine cleanup. The riskier case, covered under why blanket removal is the wrong default, is invisible Unicode in configuration files and AI agent instructions, where it is something to review rather than just clutter.

Practical rule: in ordinary Latin-script prose, a CSV export or a pasted slug, remove the stray character. In a configuration file, URL or agent prompt, inspect it first.

To see exactly what's there, paste the text into the free invisible character remover. It runs in your browser with no account or upload, lists each supported hidden character by name and code point, and removes U+200B without changing your wording.

What a format character is

U+200B isn't ordinary whitespace. It's a Unicode format character (general category Cf), so common trim and split functions usually leave it in place. Unicode reclassified it from Zs, the space separator category, to Cf, which separates it clearly from conventional spaces (Unicode PDF). That's why two strings can look identical and still fail an exact match.

Why it behaves differently from spaces

The Unicode Line Breaking Algorithm treats it as a break opportunity after the character, not before it (Unicode TR14). That matters in scripts such as Thai, Lao, Myanmar and Khmer, which don't put spaces between words, so an invisible boundary can tell software where a line may wrap. Removing it there can make the text wrap worse.

Code point Name Primary effect Safe to remove in Latin-script prose
U+200B Zero Width Space Optional line-break opportunity Usually yes
U+2060 Word Joiner Suppresses breaks Sometimes, not by default
U+00A0 No-Break Space Visible space that prevents breaks No; replace with a normal space if needed

"Zero width" describes how it looks, not whether it affects line breaking.

How zero width spaces break real workflows

The failures look random. A character count is off by one in one editor and not in another. A database join misses a row because two keys look identical but aren't byte-identical. Find and replace misses some occurrences because the target text has an invisible character in the middle. People blame Excel, the browser or the database when the cause is hidden Unicode.

Where the mismatch comes from

Code points and bytes aren't the same thing. A filter that strips ASCII spaces, tabs and line feeds won't catch U+200B because it isn't one of them. HTML adds another route: the character can arrive as the entity ​ or ​ (codepoints.net), which slips past a filter that scans the source for the literal character before entities are decoded.

Common failure modes:

  • Search misses, because the hidden code point breaks the comparison.
  • Duplicate detection fails, because one of two identical-looking rows contains an invisible character.
  • CSV validation breaks, because headers look right in a preview but fail exact comparison.
  • URL checks fail, because the encoded string isn't the same URL.

Inspect the actual characters rather than the rendered text.

Why blanket removal is the wrong default

Deleting every zero-width character cleans up messy pasted prose quickly, and for routine copy-paste that's fine. It goes wrong in two cases. Multilingual text can rely on U+200B, U+200C and U+200D for breaking or joining behavior. And AI agent configuration can carry invisible characters into downstream tools and model input, where you want to know what was there before it disappears.

Security and language have different threat models

In AI workflows, hidden Unicode is part of what a model reads. Agent rule and skill files, such as .cursorrules, .mdc and .clinerules, deserve inspection rather than a silent wipe. A March 2026 research note from the Cloud Security Alliance AI Safety Initiative, labelled as AI-assisted and not formally CSA-reviewed, describes instructions hidden in agent skill files and tool descriptions using Unicode Tags-block and zero-width characters. It recommends normalization and filtering where text enters an AI pipeline, plus linting rules that reject bidirectional overrides and Tags-block code points.

Unicode's source-code guidance recommends making default-ignorable characters visible for review. An invisible mark is a reason to inspect the context; its presence alone does not prove malicious intent.

An infographic explaining why removing zero width spaces is harmful to multilingual text and formatting consistency.

Before deleting anything, check the script, where the character sits, and whether it repeats in a pattern.

A practical detection toolkit

Start with the text itself. Paste it into a Unicode or hex viewer and look for U+200B. In a code editor that supports JavaScript-style regex, such as VS Code, search for ​; in Notepad++ or with grep -P, use \x{200B}. If the text came from HTML, decode entities first and then scan the decoded result, because the character can hide in markup until it's expanded.

Fast checks that work

A mismatch between byte length and visible character count is another clue. ZWSP is three bytes in UTF-8, so a string whose length doesn't match what you count on screen is worth inspecting.

  • Hex viewer: raw files and source snippets.
  • Regex search: editor-level cleanup.
  • Decode HTML first: web content and scraped text.
  • Byte count check: spotting hidden characters in pipelines.

For teams that validate incoming text before it enters a system, data validation with NanoPIM is relevant, since hidden characters are a validation problem as much as a formatting one.

A practical detection toolkit infographic showing four methods for identifying invisible zero width space characters in text.

Removing zero width spaces safely

For plain Latin-script text, delete the stray character. Manual removal in an editor that shows invisibles is safest but doesn't scale. Regex cleanup is fast but can hit the wrong characters if the pattern is too broad. A dedicated paste-and-clean tool suits text from a chat interface or a web page that you need cleaned before reuse.

Pick the tool by the risk

For routine cleanup, paste the text, inspect it, clean it and copy the result. The free invisible character remover shows which supported code points were present and keeps joiners and direction marks where emoji or scripts need them. For a stricter audit trail, use a script.

Keep a before and after character-level diff. If you can't review what changed, you're guessing.

Simple Unmark's main cleaner, described on the AI watermark remover page, does a different job: it removes hidden Unicode and also rewrites the wording with the aim of weakening statistical watermark patterns such as SynthID. It uses credits and sends text to a model provider for the rewrite, so it's more than you need for a stray U+200B. Zero width spaces themselves aren't a watermark and aren't evidence that AI wrote the text.

Keep an untouched copy of messy inputs and use the lightest method that fits the risk. Being able to show what changed matters more than which method you used.

When to keep the character and when to strip it

Ask three questions: what script is the text in, where did it come from, and what will consume it next? In Thai, Lao, Myanmar or Khmer prose, keep the break marker unless you have a strong reason to remove it. In Latin-script copy, a CSV export or a product slug, strip it. In a URL or an AI agent config file, audit it carefully before touching it.

Use context

Controlled cleanup with a saved original is the right default, especially when the text came from a source you don't fully trust. Simple Unmark's guide to hidden Unicode versus statistical watermarks explains how routine character cleanup differs from questions about AI watermarks. More free text utilities are on the tools page.

Invisible doesn't mean harmless, and it doesn't always mean garbage either. Inspect first, then delete only when the context makes it safe.

  • zero width space
  • U+200B
  • invisible characters
  • Unicode cleanup
  • copy paste fix

Related articles