Guide

Why Does Copied Text Contain Invisible Characters?

You copy text from a website, document, spreadsheet, or message. It looks normal after you paste it, but a search fails, a line refuses to wrap, an identifier does not match, or an emoji changes when you edit it.

The difference may be an invisible Unicode character.

Copy and paste transfers encoded text. If the source contains a no-break space, zero-width character, directional mark, variation selector, soft hyphen, or another formatting character, that code point can be copied along with the visible letters and symbols.

Invisible Characters Are Still Part of the Text

An invisible character does not need a visible glyph to exist in a string. Two pieces of text can look identical while containing different code-point sequences.

For example, one string might contain A + B, while another contains A + U+200B + B. The second string includes ZERO WIDTH SPACE between the letters even though both versions may look like “AB”.

This is why invisible and special space characters matter when text behaves differently from what appears on screen.

Which Invisible Characters Commonly Show Up in Copied Text?

Code pointNameTypical reason it may be present
U+00A0NO-BREAK SPACEKeeps surrounding text from breaking across lines
U+00ADSOFT HYPHENMarks a possible hyphenation point
U+200BZERO WIDTH SPACEInvisible word boundary or line-break opportunity
U+200CZERO WIDTH NON-JOINERControls joining behavior in applicable scripts
U+200DZERO WIDTH JOINERControls joining behavior or participates in emoji ZWJ sequences
U+200ELEFT-TO-RIGHT MARKInfluences bidirectional text layout
U+200FRIGHT-TO-LEFT MARKInfluences bidirectional text layout
U+2060WORD JOINERPrevents a line break without adding visible width
U+FE0FVARIATION SELECTOR-16Requests emoji-style presentation where a variation sequence is defined
U+FEFFZERO WIDTH NO-BREAK SPACEOften encountered as a byte order mark or through legacy text processing

These characters do not all behave alike. “Invisible character” describes their appearance to a reader, not a single Unicode function.

Why Can a Website Copy a Hidden Space?

A webpage may use U+00A0 NO-BREAK SPACE when text should stay together across a line. In HTML, the named character reference   represents that Unicode character.

Once the page is parsed, the text contains U+00A0 itself. If you copy the text, the no-break space may be copied too. The pasted phrase can therefore look as though it contains a normal space even when the underlying code point is different.

Why Can Formatted Documents Carry Extra Characters?

Formatted text can contain information that is easy to miss visually: no-break spaces, discretionary hyphens, directional controls, specialized spacing characters, and other formatting code points.

Those characters may be useful in the source document because they control wrapping, shaping, or text direction. After paste, however, the destination may treat them differently or expose them through exact matching.

Soft Hyphens Are Easy to Miss

U+00AD SOFT HYPHEN marks a possible hyphenation point. It is often not visible unless a line actually breaks at that position.

That makes it a classic source of confusion: a copied word can look ordinary while still containing an extra character internally.

Emoji Can Contain Invisible Joiners

Some emoji that appear as one pictograph are multi-code-point sequences. Recommended emoji ZWJ sequences use U+200D ZERO WIDTH JOINER between their components.

When you copy the displayed emoji, the joiner comes with it because it is part of the encoded sequence. Removing it can turn one combined pictograph into separate emoji.

This is one reason a blanket rule to “delete all invisible characters” is unsafe. The practical differences between U+200B, U+200C, and U+200D are explained in Zero Width Space vs Zero Width Joiner vs Zero Width Non-Joiner.

Multilingual Text May Need Invisible Controls

Text that mixes writing directions or uses scripts with contextual joining can legitimately contain invisible controls. LEFT-TO-RIGHT MARK and RIGHT-TO-LEFT MARK influence bidirectional layout; ZWNJ and ZWJ can affect shaping.

Removing those characters without understanding the language or formatting context can change the displayed text.

Why Do Two Identical-Looking Strings Fail to Match?

Exact comparison works with encoded characters, not visual similarity. A string containing U+0020 SPACE is not the same code-point sequence as one containing U+00A0 NO-BREAK SPACE in the same position.

The same issue occurs when a zero-width character sits inside a word. Depending on the application, this can affect:

  • find and replace;
  • database equality checks;
  • spreadsheet lookups;
  • usernames and identifiers;
  • filenames;
  • source code and configuration values;
  • URLs and imported data.

Unexpected Line Wrapping Is Another Clue

Some hidden characters mainly affect line breaking. U+00A0 NO-BREAK SPACE and U+2060 WORD JOINER inhibit ordinary breaks, while U+200B ZERO WIDTH SPACE can introduce a break opportunity.

If text wraps somewhere surprising—or refuses to wrap where a normal-looking space appears—the exact code point may explain the behavior. Non-Breaking Space vs Regular Space looks specifically at the most common space-related case.

How to Find Invisible Characters in Copied Text

Visual inspection is not enough. Inspect the actual code points.

Useful approaches include:

  • turning on “show invisibles” or whitespace markers in a text editor;
  • using a Unicode code-point inspector;
  • comparing code-point counts between copied and manually typed text in a Unicode-aware tool;
  • examining the string with a Unicode-aware programming tool.

If the character itself is unfamiliar, What Is This Symbol is useful because exact character identity matters more than what an apparently blank position looks like. For a step-by-step cleanup workflow, see How to Find and Remove Invisible Unicode Characters Without Breaking Text.

Should You Strip Invisible Characters From Copied Text?

Only after identifying them. Some are accidental in the destination context; others carry important information.

  • An NBSP may intentionally prevent an awkward line break.
  • A ZWNJ may be required for correct shaping.
  • A ZWJ may be part of an emoji sequence.
  • A directional mark may be controlling bidirectional layout.
  • A soft hyphen may be part of document hyphenation.
  • An unexpected ZWSP inside an identifier may genuinely be unwanted.

A Safer Cleanup Process

  1. Identify the code point. Do not infer it from appearance.
  2. Determine its function. Is it controlling spacing, breaking, shaping, direction, presentation, or encoding?
  3. Decide whether that function is needed in the destination text.
  4. Remove or replace the character only when you know it is unwanted.

The Main Point

Copied text can contain invisible characters because invisible characters are still encoded data. Copy and paste can preserve spaces, joiners, formatting marks, variation selectors, and other code points that do not display an obvious glyph.

When pasted text behaves differently from text that looks identical, inspect the code points before changing the visible characters. The cause may be something you cannot see.

1 thought on “Why Does Copied Text Contain Invisible Characters?”

Leave a Comment