tdy / blog / see hidden characters

How to see hidden characters in any text

Updated July 2026 · 4 min read
Short answer

For a one-off mystery, a hex dump settles the argument: pbpaste | hexdump -C. For code, turn on your editor's invisibles highlighting and leave it on. For a string you cannot paste anywhere, a targeted regex search finds the usual suspects.

You cannot fix what you cannot see. When a string misbehaves, when a search will not match, a form rejects clean-looking input, or a diff shows a change with nothing visibly different, the first step is making the invisible visible. Here are four ways to do that.

1. Your code editor's invisibles mode

Every serious editor can render invisible characters. Most hide the setting.

Editor rendering is ideal for code, because you stay exactly where the bug is.

2. A regex sweep

If you suspect a specific character, search for it directly. Most find dialogs accept Unicode escapes in regex mode, which avoids the awkward problem of typing an invisible character into a search box:

[\u200B\u200C\u200D\u2060\uFEFF\u00A0\u202F\u00AD]

That one class catches the usual suspects: the zero-width space, both joiners, the word joiner, the byte-order mark, the non-breaking and narrow no-break spaces, and the soft hyphen. It will not catch everything, since Unicode has hundreds of format characters, but it finds the ones responsible for most real breakage.

3. A hex dump

The ground truth. On macOS, pipe the clipboard through hexdump:

pbpaste | hexdump -C | head

A zero-width space appears as the UTF-8 bytes e2 80 8b, a narrow no-break space as e2 80 af, a non-breaking space as c2 a0. Nothing can hide from a byte listing, which makes this the method of record when you need certainty and the least convenient one for everyday use.

4. An online inspector

Paste-in web tools list every code point in a string with its name. They are quick and require nothing installed. Two caveats. First, you are pasting your text into someone else's website, which is a strange move if the text is private. Some process locally in the browser; verify before trusting. Second, they tell you what is there. Removing it and re-copying is still on you, every single time.

Which one should you use?

SituationUse
A one-off mystery stringHex dump
Code and configs, all dayEditor invisibles, permanently on
Hunting a specific characterRegex sweep
No terminal, no editorOnline inspector, carefully

All four are diagnosis. If you find yourself diagnosing weekly, the honest conclusion is that invisible characters are not rare events, they are a constant low-level leak in copy and paste itself, and the cure is to treat the clipboard rather than the symptom. See the full field guide for what, exactly, is leaking.

Text cleaning is coming next to tdy.

tdy is a Mac menu-bar app that already tidies every link you copy. Catching invisible characters at the moment you copy, with nothing to paste into and nothing to remember, is the next upgrade. One email when it ships, nothing else.

Join the launch list

Related