Text to Hex & Hex to Text · Tutorial
How to find invisible characters hiding in text
5 min readbeginnerUpdated
A value looks right but behaves wrong. A price won't parse, two identical-looking names don't match, or a search can't find a word that's clearly there. Invisible characters are a common cause. This tutorial reveals them with the Text to Hex tool and shows how to remove them.
What you need
- The Text to Hex & Hex to Text converter
- The suspicious text (the Try it button loads a price with two hidden characters)
Steps
Paste the text
Paste the value into the left box. The sample,
Total: 120 EUR (incl. VAT), looks normal.Look at the bytes
In the hex output, normal characters are one byte each. Look for longer runs. The sample contains
E2 80 8Bbetween1 2and0, andC2 A0before(.Open Character details
Open Character details. The table shows
U+200B(a zero-width space, a format character) inside the number, andU+00A0(a non-breaking space) where a normal space should be. The zero-width space explains why120won't parse as a number.Remove them
Paste the text into Remove Extra Spaces with Fix invisible and non-breaking spaces ticked. It turns lookalike spaces into normal ones and deletes zero-width characters. Then check again here. Every character should now be one byte.
Try it yourself
Opens the Text to Hex & Hex to Text with this tutorial's sample loaded.
Common mistakes
- Retyping instead of checking
- Retyping a value can fix it, but you won't know what caused the problem, and the same source will produce it again. Find the character, then fix the source, often a copy from a website or PDF.
- Assuming every multi-byte character is a problem
- Accented letters and non-Latin scripts are legitimately two or more bytes. Only format and space characters in unexpected places are suspects.
- Removing characters that matter
- Zero-width joiners (U+200D) are part of some emoji and scripts. Remove invisible characters only from values like codes, numbers and identifiers.
Next steps
Go back to the Text to Hex & Hex to Text, or keep going with one of these:
FAQ
Where do these characters come from?
Mostly from copying text out of web pages, PDFs, word processors and chat apps, which use them for layout and line-breaking.