InputTestHub

Why Two Texts That Look the Same Don't Match

A search finds nothing for a word that is plainly on the page. A spreadsheet lookup fails on a name you can read with your own eyes. A password that you are sure you typed correctly is refused. The screen is not lying, but it is not telling you everything either.

9 min read · updated 15 September 2026 · links to 8 tools

In short Two pieces of text can look identical and still be different, because a computer compares the characters stored, not the shapes drawn. The usual culprits are invisible characters such as the zero-width space, which takes up no room at all; the non-breaking space, which looks exactly like an ordinary space; curly quotes and apostrophes swapped in by autocorrect; the same accented letter stored as one character or as a letter plus a separate accent; and letters from another alphabet that share a shape with Latin ones, such as the Cyrillic а. Each one makes the text longer or different underneath while leaving the screen unchanged. To find the cause, compare the two texts character by character, or list every character with its code point; to fix it, remove or replace the offending characters, taking care not to strip joiners that emoji and some scripts genuinely need.

The screen shows shapes, not characters

Every character in a text is stored as a number called a code point. The letter h is U+0068, an ordinary space is U+0020. A font turns those numbers into shapes, and some numbers are deliberately drawn as nothing at all, or as the same shape as a different number. Comparison, searching and sorting all work on the numbers.

So “hello world” typed on a keyboard and “hello world” pasted from a web page can be different strings. In the figure below, the pasted copy carries one extra character that has no width. It is one character longer and three bytes longer in UTF-8, the encoding almost every web page and file uses, and no amount of looking will show it.

Two rows of character boxes for hello world. The typed row has 11 characters and 11 bytes; the pasted row looks identical but has a zero-width space, U+200B, after hello, making 12 characters and 14 bytes.
The same words on screen, a different string underneath. The highlighted box is a zero-width space.

Five differences you cannot see

Each pair in this table looks the same in most fonts. The lengths and byte counts come from running the pairs through the tools on this site.

Looks likeWhat is really thereCharactersUTF-8 bytes
hello worldA zero-width space (U+200B) before the space11 vs 1211 vs 14
hello worldA non-breaking space (U+00A0) instead of a space11 vs 1111 vs 12
don'tA curly apostrophe (U+2019) instead of a straight one5 vs 55 vs 7
cafée followed by a combining accent (U+0301) instead of é (U+00E9)4 vs 55 vs 6
paypalA Cyrillic а (U+0430) instead of a Latin a6 vs 66 vs 7
Two rows have the same number of characters and still differ. Counting characters is not enough; the only reliable check is comparing the characters themselves.

Zero-width characters

The zero-width space, zero-width joiner, zero-width non-joiner, word joiner and byte-order mark are all drawn as nothing. They arrive through copying from web pages, PDFs, chat apps and some editors, and a byte-order mark often sits at the very start of a file saved as “UTF-8 with BOM”, where it breaks the first value of a CSV or the first line of a script.

They are the most common reason a pasted value fails to match, and the easiest to remove. The invisible character detector lists each one by name and position, and Text Cleaner removes them.

Not every zero-width character is junk. The zero-width joiner holds multi-person emoji together: removing it from the family emoji 👨‍👩‍👧 splits one emoji into three separate people. Persian and Urdu spelling uses the zero-width non-joiner to keep letters apart inside a word. For text containing either, turn off Text Cleaner's invisible-characters switch.

Non-breaking spaces

A non-breaking space stops a line from wrapping between two words, which is why web pages use it between a number and its unit. It is drawn exactly like a space, and it is a different character. Copy a product name or a price from a web page and there is a good chance one is inside it.

Spreadsheets are where this hurts most. Microsoft documents that Excel's TRIM function removes only the ordinary space, character 32, so a cell carrying a non-breaking space, character 160, still refuses to match after trimming. Replacing character 160 with a normal space first, or cleaning the text before it reaches the sheet, fixes the lookup.

Curly quotes and dashes

Word processors and phone keyboards replace straight quotes with curly ones and double hyphens with dashes as you type. That is good typography and bad data: a curly apostrophe in a password, a search term, a spreadsheet formula or a line of code is a different character from the straight one the other side expects.

Going the other way is just as easy to get wrong, so convert deliberately. Smart Quotes Converter turns straight quotes into curly ones or back, and Text Cleaner straightens them as one of its switches.

The same letter, stored two ways

An accented letter such as é can be stored as a single character, or as a plain e followed by a separate combining accent. Both draw the same, and the second is one character longer. Text typed on one system and pasted from another can mix the two, and older Mac disks stored file names in the separated form, which is why a file name can look right and still not be found.

The fix is normalisation: converting both texts to the same form before comparing them. Most programming languages provide it, usually as a function called normalize, and the composed form, NFC, is the usual choice. The stricter NFKC form goes further and also turns a non-breaking space into a plain space, but it does nothing about zero-width characters or letters from other alphabets. Removing invisible characters does not fix this case either, because both forms are made of visible characters. To see which form a text uses, look at its code points in Unicode Character Lookup.

Letters borrowed from another alphabet

Cyrillic and Greek both contain letters with the same shape as Latin ones: the Cyrillic а, е, о, р and с, the Greek ο and ν. Mixed into a Latin word they are invisible to a reader and completely different to a computer. That is the basis of lookalike web addresses and usernames built to impersonate real ones, and it also happens innocently when someone switches keyboard layouts halfway through a word.

Cleaning cannot fix this, because these are real letters with a real job in their own language. The homograph checker flags them and names the Latin letter each one imitates, so they can be retyped.

Spaces at the ends of lines, tabs and line endings

In code, configuration files and lists, the differences are often in the whitespace: a space left at the end of a line, a tab where the other copy has spaces, or a Windows line ending (CR LF) where the other has a Unix one (LF). A comparison by characters shows the first two: Text Compare draws tabs as → and spaces at the end of a line as ·.

Line endings need a different approach. A text box in a web browser converts Windows line endings to LF the moment text is pasted, so two files that differ only in their line endings will look identical in any browser tool you paste them into. Check line endings in a code editor, which normally shows them in its status bar, or change them with Line Ending Converter.

How to find the difference, step by step

  1. Paste both texts into Text Compare and compare by characters. The first difference is reported by line and column, and invisible characters inside a change are named, such as [ZWSP] or [NBSP].
  2. If the texts still look the same where it points, list the characters around that spot with their code points. A code point you do not recognise is the answer.
  3. If a letter looks right but is flagged, check it for a lookalike from another alphabet.
  4. If the difference is an accent, normalise both texts to the same form rather than deleting anything.
  5. Otherwise clean the text, check the preview of what was removed, and compare again. Leave the invisible-characters switch off for emoji sequences and for Persian or Urdu text.

Frequently asked questions

Why do two identical words not match?
Because they are stored as different characters. The usual causes are an invisible character such as a zero-width space, a non-breaking space instead of an ordinary one, a curly apostrophe instead of a straight one, an accent stored as a separate character, or a letter from another alphabet with the same shape.
What is a zero-width space?
A character, U+200B, that marks a place where a line may break but is drawn with no width at all. It is invisible on screen, takes three bytes in UTF-8, and makes a string different from the same words without it.
Why does Excel TRIM not remove the space?
Excel's TRIM removes only the ordinary space, character 32. A non-breaking space, character 160, is left in place, so the cell still does not match. Replace character 160 with a normal space first.
Can removing invisible characters break my text?
Yes, in two cases. Multi-person and some other emoji are held together by zero-width joiners, and Persian and Urdu spelling uses zero-width non-joiners. Removing those changes how the text displays, so leave invisible characters in for that kind of text.
How do I see hidden characters in text?
List every character with its code point, or compare the text character by character against a clean copy. Both show characters that are drawn as nothing or look like something else.
Why does a word with an accent not match the same word?
An accented letter can be stored as one character or as a letter followed by a combining accent. They look the same but are different strings. Normalising both texts to the same form, usually NFC, makes them match.

More guides