What Is a Zero-Width Space?
The zero-width space (ZWSP, U+200B) is a Unicode character with no width and no glyph. It tells text layout that a line may break at that point without showing a space. That makes it useful for scripts written without spaces between words and for long strings such as URLs, and it also makes it easy to copy into your text by accident.
Where Zero-Width Spaces Come From
- Copying from web pages and chat interfaces that use them for line breaking.
- CMS and editor features that insert them while formatting.
- Word processors and PDF conversions.
- Messaging apps and spreadsheets that pass text along unchanged.
- People or tools that add them on purpose, for example to break up a keyword or to tag a piece of text.
How to Tell If Your Text Has One
The usual signs are a cursor that needs an extra key press to cross a gap, a string whose length is longer than what you can see, a search that misses a word that is clearly there, and a lookup or login that fails for no visible reason. In JavaScript, "a\u200Bb".length is 3 even though it looks like two letters. Paste the text into the tool above and click Scan to see every zero-width character as a labelled tag.
How to Remove Zero-Width Spaces
Paste your text into the tool above and click Clean Text. If you need to do it somewhere else, these one-liners remove U+200B only:
| Where | How |
|---|---|
| Excel | =SUBSTITUTE(A1,UNICHAR(8203),"") |
| Google Sheets | =REGEXREPLACE(A1,"\x{200B}","") |
| VS Code (Find and Replace with regex on) | Find \u200B and leave Replace empty |
| JavaScript | text.replace(/\u200B/g, '') |
| Python | text.replace('\u200b', '') |
| Linux terminal | perl -CSD -pe 's/\x{200B}//g' file.txt prints the cleaned text, so redirect it to a new file |
ZWSP, ZWNJ, ZWJ, Word Joiner and BOM Compared
Several zero-width characters look alike but do different jobs, which is why deleting all of them blindly can damage real text.
| Character | Code point | What it does | Safe to delete? |
|---|---|---|---|
| Zero-width space | U+200B | Allows a line break and shows nothing | Almost always |
| Zero-width non-joiner | U+200C | Stops neighbouring letters from joining | Not in Persian, Urdu or Indic-script text |
| Zero-width joiner | U+200D | Joins letters, or builds emoji sequences | Not inside emoji or Indic-script text |
| Word joiner | U+2060 | Forbids a line break | Usually |
| Byte order mark | U+FEFF | File signature at the start of a file, or a legacy no-break joiner | Yes inside text; some programs, such as Excel opening a UTF-8 CSV, use it at the start of a file |
The tool above cleans this whole family in one pass, and Safe mode keeps ZWNJ and ZWJ only where they belong.