textscrubr
Home / Blog / Hidden characters

How to Detect Hidden Characters in Text

Hidden characters2 min readUpdated 2026-06-23
To detect hidden characters, paste your text into a cleaner that reports what it finds, enable show-whitespace in your editor, or check the byte length against the visible character count. Tools that scan by Unicode code point are the most reliable way to find zero-width spaces, BOMs, and non-breaking spaces.

You cannot see hidden characters by definition, but you can absolutely detect them. Here are the reliable methods, from easiest to most technical.

Method 1: a cleaner that reports what it finds

The simplest detector is a cleaner that lists what it removes. Paste your text in and read the report: if it shows zero-width spaces, a byte-order mark, non-breaking spaces, or direction marks, those characters were present. textscrubr does this in your browser, showing a count of each hidden character it found, which turns the invisible into something you can actually see and verify.

Method 2: show whitespace in your editor

Many code editors can reveal invisible characters:

These display markers where normal spaces, tabs, and sometimes special spaces sit, so anomalies stand out.

Method 3: compare byte length to visible length

A quick technical check: a hidden character adds to the byte or code-point count without adding anything visible. If a string looks like 10 characters but reports 12, two are hiding. You can check this in a console:

text.length          // code point-ish count in JavaScript
len(text)            # character count in Python

If the number is higher than what you can see, you have passengers.

Method 4: search by code point

If you know what you are hunting, search directly:

Which method to use

For a quick check on any text, the cleaner-report method is fastest and needs no setup. For ongoing work in code, turn on whitespace rendering so you catch them as you type. For automated pipelines, scan by code point in a script. In every case, once you have detected them, removing them is the easy part.

Scrub this text in one click

textscrubr strips the hidden characters, em dashes, and double spaces, and keeps your lists, headings, and code exactly where you put them. Free, and it runs entirely in your browser.

Clean my text free →

Frequently asked questions

How can I see invisible characters in text?

Paste it into a cleaner that reports what it finds, or enable show-whitespace in your editor. VS Code can highlight non-breaking spaces and unusual characters automatically.

How do I know if text has a zero-width space?

Search for the code point \u200B in a regex-capable editor, or paste the text into a cleaner that lists zero-width characters. Comparing character count to visible length also reveals hidden passengers.

Why is my character count higher than what I can see?

Because hidden characters add to the count without adding anything visible. The difference between the visible length and the reported length is the number of invisible characters present.