How to Remove Hidden Characters From Copied Text
By Khushi Yadav
Copied text, especially from web pages and PDFs, often contains characters you can't see: soft hyphens (U+00AD), zero-width spaces (U+200B), non-breaking spaces (U+00A0) and byte order marks (U+FEFF). Pasting as plain text doesn't remove them, because they're characters, not formatting. Delete them with Word's Find and Replace (Special menu), a regular-expression replace in an editor such as VS Code, or a short PowerShell command that cleans the clipboard before you paste.
The hidden characters you'll usually find
| Character | Code point | Where it comes from | What goes wrong |
|---|---|---|---|
| Soft hyphen | U+00AD | Web pages and PDFs that hyphenate long words | Search misses the word; stray hyphens appear in some apps |
| Zero-width space | U+200B | Web layouts that allow line breaks inside long strings | Words look normal but don't match in search; code and IDs break |
| Word joiner | U+2060 | Exported or generated text | Invisible character before or inside words |
| Byte order mark | U+FEFF | Text from files saved with a BOM | Invisible character at the start of the text breaks the first value |
| Non-breaking space | U+00A0 | "10 MB", names and prices on web pages | Lines won't wrap; formulas and scripts don't treat it as a normal space |
Two related characters, the zero-width joiner (U+200D) and zero-width non-joiner (U+200C), also look invisible, but don't remove them blindly. They hold emoji sequences together and are needed in scripts such as Persian and Arabic.
How to tell hidden characters are there
- Search fails for a word you can see on screen.
- The cursor sticks: you press the right arrow and it doesn't move, because it stepped over an invisible character.
- Word or character counts are higher than they should be.
- A pasted command or value fails even though it looks identical to one that works.
- In Word, press Ctrl+Shift+8 to show nonprinting characters. A non-breaking space shows as a small degree-like symbol.
Remove them in Word
- Press Ctrl+H to open Replace.
- Select More, click in Find what, then select Special.
- Choose Optional Hyphen (Word enters
^-) to find soft hyphens. Leave Replace with empty. - Select Replace All.
- Repeat with Special > Nonbreaking Space (
^s), and type a normal space in Replace with.
Run the replacements on a copy of the document first, or be ready to press Ctrl+Z. Keep non-breaking spaces where you want them, such as between a number and its unit.
Word's Special menu doesn't list zero-width spaces. For those, use one of the methods below.
Remove them in VS Code or another regex editor
- Paste the text into a new file in VS Code.
- Press Ctrl+H to open Replace, then Alt+R to turn on regular expressions.
- In the find box, enter
[\u00AD\u200B\u2060\uFEFF]and leave the replace box empty. - Select Replace All.
- To swap non-breaking spaces for normal ones, find
and replace with a single space.
Notepad++ and most other code editors can do the same with their regex search. Regex vs clipboard tools for cleaning pasted text covers more patterns.
Clean the clipboard itself with PowerShell
This removes the characters from whatever text is on the clipboard, so your next Ctrl+V pastes the clean version. It works in Windows PowerShell 5.1 and PowerShell 7:
$text = Get-Clipboard -Raw
$text = $text -replace '[\u00AD\u200B\u2060\uFEFF]', ''
$text = $text -replace ' ', ' '
Set-Clipboard -Value $text
The first replacement deletes soft hyphens, zero-width spaces, word joiners and byte order marks. The second turns non-breaking spaces into normal spaces; leave that line out if you want to keep them. The -Raw switch keeps line breaks intact. The PowerShell clipboard cheat sheet has more commands like this.
Plain-text paste isn't enough on its own
Ctrl+Shift+V and Word's Keep Text Only remove fonts, colours and links, not characters. Paste as plain text first (how to paste without formatting), then remove hidden characters with one of the methods above.
Other text problems need their own fix:
- Smart quotes and em dashes: smart quotes and em dashes.
- Broken line breaks from PDFs: how to copy from a PDF without broken line breaks.
- Tracking parameters in links such as
utm_sourceorfbclid: how to copy a clean link without tracking parameters.
FAQ
Does Notepad show hidden characters?
Not reliably. Notepad has no option to display invisible characters, so they're easy to miss there. Use Word's formatting marks or a code editor instead.
Why would a website add zero-width spaces?
Usually to let long strings, such as URLs or product codes, wrap at narrow screen widths. The character stays in the text when you copy it.
Is it safe to remove every non-ASCII character instead?
No. That also deletes accented letters, curly quotes, currency symbols and emoji. Target the specific invisible characters listed above.
Related reading
- How to Paste Without Formatting on Windows
- How to Clean Up Pasted Text With Find and Replace
- How to Copy a Link Without Tracking Parameters (UTM)
- How to Paste Into Windows Terminal Safely
Sources
- Latin-1 Supplement code chart (Unicode) — U+00A0 no-break space and U+00AD soft hyphen.
- General Punctuation code chart (Unicode) — U+200B zero width space, U+200C, U+200D and U+2060 word joiner.
- Find and replace text (Microsoft Support) — the Special menu in Find and Replace.
- Keyboard shortcuts in Word (Microsoft Support) — Ctrl+H and Ctrl+Shift+8.
- Get-Clipboard (Microsoft Learn) — the
-Rawparameter. - Set-Clipboard (Microsoft Learn) — the
-Valueparameter. - Control the formatting when you paste text (Microsoft Support) — Keep Text Only removes formatting, not characters.
Khushi Yadav writes Edge Drop's workflow and design guides and is a B.Tech Computer Science Engineering student. Khushi's posts are checked against Microsoft's documentation and the Edge Drop fact sheet.
GitHub · LinkedInCopy. Stack. Drop.
Transform your clipboard into an interactive edge shelf. Stack, pin, and drag assets into any app with zero friction.
Download for Windows Get from Microsoft Store
How to Install Guide · First 10 Minutes Guide · Drag & Drop Guide · Edge Drop vs Win+V · Support
Free · Lightweight · Privacy First