Find and Remove Zero-Width Spaces (ZWS)
Detect invisible zero-width space characters (U+200B) that break URLs, code, and string comparisons. Visualize and remove them instantly.
Detailed Explanation
Zero-Width Spaces: The Invisible Bug
The zero-width space (ZWS, U+200B) is one of the most frustrating characters in Unicode. It takes up absolutely no visible width, meaning it is completely invisible in text editors, terminals, and web browsers — yet it is a real character that affects string comparisons, parsing, and processing.
Where ZWS Characters Come From
- Web page copy-paste: HTML editors and CMS platforms often insert ZWS characters for text shaping and word-break hints.
- Messaging apps: Slack, Discord, Teams, and WhatsApp sometimes insert ZWS in pasted content.
- Internationalization: ZWS is used as a word-break opportunity in scripts without explicit spaces (Thai, Khmer, Myanmar).
- Steganography: ZWS characters can be used to embed hidden information in text (watermarking).
- Rich text editors: WYSIWYG editors insert ZWS to maintain cursor position in empty elements.
How the Visualizer Shows ZWS
Each zero-width space appears as a red [ZWS] marker in the visualization output. The statistics panel shows the total count.
Real-World Problems
// These look identical but are not equal:
const a = "hello"; // clean
const b = "hel\u200Blo"; // ZWS between l and l
a === b // false!
a.length // 5
b.length // 6
ZWS also breaks:
- URL parsing: A ZWS in a URL makes the URL invalid
- Email addresses: A ZWS in an email causes delivery failure
- JSON keys: Two keys that look identical but differ by a ZWS
- Regex matching: Pattern
hellowon't matchhel\u200Blo - Database queries: WHERE clause won't find the record
Removing ZWS Characters
In the Clean section, enable the ZWS toggle and click Clean. For a broader cleanup, also enable ZWJ and ZWNJ to remove all zero-width characters at once.
Use Case
A QA engineer reports that a search feature doesn't find certain records even though the search term looks correct. The developer pastes the failing search term into the Whitespace Visualizer and discovers a zero-width space in the middle of the word, copied from the Jira ticket description.
Try It — Whitespace Visualizer
Related Topics
Detect Zero-Width Joiners and Non-Joiners (ZWJ/ZWNJ)
Zero-Width Characters
Find and Remove Non-Breaking Spaces (NBSP)
Common Characters
Clean Hidden Characters from Copy-Pasted Text
Common Characters
Detect and Remove Byte Order Mark (BOM)
Unicode Whitespace
Debug Invisible Characters in JSON Data
Unicode Whitespace