Zero Width Space (U+200B) | The Ultimate Invisible Formatting Tool
The zero-width space (U+200B) is an invisible character used in formatting, names, and keyword splitting.
Table of Contents
What Is a Zero Width Space?
The Zero Width Space (U+200B) is a non-visible Unicode character that acts as a breakable point in text without adding any visual space. Unlike regular spaces, it has zero width but allows:
? Line-breaking opportunities in long words/URLs
? Word separation without visual gaps
? Formatting control in scripts and programming
Quick Reference
Type | Code |
---|---|
Unicode | U+200B |
HTML Entity | or |
CSS Code | \200B |
JavaScript | \u200B |
How to Use Zero Width Space
1. Inserting in Text
- HTML: html
-
ThisIsALongWord
- JavaScript: javascript
- const text = “LongWord”.split(”).join(‘\u200B’);
2. Copy-Paste Method
Copy this invisible character: “” (select between quotes)
Actual Applications
1. Preventing Text Overflow
html
ThisIsAVeryLongWordWithoutSpaces
Result: The text breaks neatly at the Zero Width Space instead of overflowing.
2. URL & Code Formatting
html
Link
Benefit: Allows URLs to break naturally in emails/docs.
3. Invisible Text Separation
javascript
// Useful for React/JSX keys without affecting layout
Zero Width Space vs. Other Spaces
Character | Width | Visible? | Use Case |
---|---|---|---|
Zero Width Space (U+200B) | 0 | ? No | Hidden word breaks |
Regular Space (U+0020) | Variable | ? Yes | Standard word spacing |
Non-Breaking Space (U+00A0) | 1 em | ? Yes | Preventing line breaks |
Thin Space (U+2009) | 1/6 em | ? Yes | Small visual separation |
Do's and Don'ts
? Accessibility Note:
- Screen readers ignore Zero Width Spaces
- Don’t overuse (can cause unexpected text parsing issues)
? Pro Uses:
- Prevent copy-paste distortion in formatted text
- Create break points in hashtags (
#ZeroWidthSpace
) - Test text handling in apps (reveals layout bugs)
Public Asked Questions
Q: Why can’t I see my Zero Width Space working?
A: It’s invisible by design! Test by:
- Pasting into a code editor (shows as
[ZWSP]
) - Checking text selection highlights
Q: Does this affect SEO?
A: No – search engines treat it as a neutral character.
Q: How to remove accidental Zero Width Spaces?
A: Use regex:
javascript
text.replace(/\u200B/g, '');