Writing & Text

Invisible Characters Explained: Zero-Width Spaces and Friends

Unicode has a handful of characters that take up no space on screen. Here is what each one is for, where it causes trouble, and how to find and remove it.

Invisible Characters Explained: Zero-Width Spaces and Friends
Photo by Lukas Blazek on Pexels

Key takeaways

  • Zero-width characters are real Unicode code points with real typographic jobs; they are not bugs or glitches.
  • The Hangul filler (U+3164) is the character behind most "blank" usernames because validators treat it as a letter.
  • In code and spreadsheets a single hidden character makes two identical-looking values compare as different.
  • Paste suspect text into a whitespace or formatting remover to strip every hidden character in one pass.
  • Hidden-message tools encode each letter as eight zero-width characters, so a short note can hide inside any sentence.

Invisible characters are Unicode code points that render as nothing, or as an empty gap, yet still count as text. The common ones are the zero-width space (U+200B), the zero-width joiner (U+200D), the word joiner (U+2060), the Hangul filler (U+3164) and the non-breaking space (U+00A0). Each exists for a legitimate typographic reason, and each causes real trouble when it ends up somewhere it does not belong, such as a spreadsheet cell, a password field or a line of code.

Why Unicode has characters you cannot see

Text is more than letters. Writing systems need ways to say "you may break a line here", "do not break the line here", "join these two glyphs" and "keep these apart". In printed typesetting a human made those decisions. In digital text the decisions travel with the characters, so Unicode defines control-like code points that carry layout instructions without drawing anything.

That is the key idea. A zero-width space is not an empty space; it is an instruction that says "this is a word boundary". A word joiner says the opposite. A joiner says "fuse the glyphs on either side". None of them have a visual shape, which is why they are so easy to lose track of.

The table below lists the characters you are most likely to meet, with their code points and what they are supposed to do.

CharacterCode pointAbbreviationIntended job
Zero-width spaceU+200BZWSPMarks a place where a line may break without showing a gap
Zero-width non-joinerU+200CZWNJStops two letters from forming a ligature or connected form
Zero-width joinerU+200DZWJForces two letters, or two emoji, to combine into one glyph
Word joinerU+2060WJForbids a line break at that point, with no visible width
Zero-width no-break spaceU+FEFFBOMByte order mark at the start of a file; a no-break point elsewhere
Hangul fillerU+3164HFPlaceholder in Korean input that is classed as a letter
Non-breaking spaceU+00A0NBSPA visible space that forbids a line break

What each character is actually for

Zero-width space (U+200B)

Some scripts, including Thai and Khmer, do not put spaces between words. Software still needs to know where one word ends so it can wrap lines sensibly, and the ZWSP provides that hint. In English it is useful for the same reason in a narrower case: a long URL or file path with no natural break point. Insert a ZWSP after each slash and the browser can wrap the address neatly instead of overflowing the column.

Zero-width joiner and non-joiner (U+200D, U+200C)

The ZWJ is the glue inside multi-person emoji. The family emoji is not one code point; it is a man, a ZWJ, a woman, a ZWJ and a child, which a modern font merges into a single picture. Skin tones, professions and some flags work the same way. In Arabic, Persian and the Indic scripts the ZWJ and ZWNJ control whether neighbouring letters connect, which can change the meaning of a word. Persian in particular depends on the ZWNJ for the correct spelling of common plurals.

Word joiner (U+2060)

Where the ZWSP invites a line break, the word joiner forbids one. It has no width, so it is the right tool when you want "10km" or a product code to stay on one line without introducing a visible gap. Older documents used U+FEFF for this, which is why that code point has two names; the word joiner was added in Unicode 3.2 to separate the two jobs.

Hangul filler (U+3164)

This one is the odd one out. It is a leftover from Korean keyboard input, a placeholder that stands in for a missing syllable part. Unicode classifies it as a letter, not as a space or a format character. That classification is why it is the usual trick for a blank username: a form that rejects "empty" names and strips spaces will happily accept a string made of nothing but Hangul fillers, because to the validator it looks like a word.

Non-breaking space (U+00A0)

The NBSP is the only character on this list you can see. It looks exactly like a normal space, but a line will never wrap at it. Typesetters use it between a number and its unit, between initials, and before a closing French punctuation mark. It arrives in your text whenever you copy from a web page, because HTML authors write it as   to stop browsers collapsing consecutive spaces.

A magnifying glass held over printed text
Photo by Nothing Ahead on Pexels

Legitimate uses people reach for

Most people who go looking for these characters on purpose want one of three things.

  • Blank names and messages. Games, chat apps and social networks often insist on at least one character. A Hangul filler or a ZWSP satisfies the rule while showing nothing. The Invisible Text Generator lets you copy a single character or a block of them, and tells you which code point each option uses so you can pick the one a given platform accepts.
  • Line control. Writers of email newsletters and product descriptions use a ZWSP to allow wrapping inside a long word, and an NBSP or word joiner to stop a price such as "£1 200" splitting across lines. Social media captions use a ZWSP on an otherwise empty line to force a paragraph break where the app would normally collapse blank lines.
  • Watermarks and fingerprints. Because the characters survive copy and paste, you can plant a unique pattern of them in each copy of a document you send out. If the text leaks, the pattern identifies which copy it came from. Newsrooms and legal teams have used exactly this technique.

If you only need an empty-looking username, try the Hangul filler first. If the platform rejects it, a ZWSP or a run of braille blank characters (U+2800) is the usual fallback.

How they break code, spreadsheets and searches

The same property that makes these characters useful, invisibility, makes them dangerous in any context where exact matching matters. The string "admin" and the string "admin" followed by a ZWSP look identical on screen and compare as different in every programming language, database and spreadsheet.

Typical symptoms:

  • A VLOOKUP or XLOOKUP returns "not found" for a value you can plainly see in the other sheet. One of the two cells has a trailing NBSP or ZWSP, usually from a copy out of a web page or a PDF.
  • A column of apparently duplicate entries will not de-duplicate, because the duplicates differ by a hidden character. Pivot tables then show "London" twice.
  • Code copied from a blog post refuses to compile or run. Some sites inject ZWSPs into code samples to defeat scrapers, and a ZWSP inside a variable name is a syntax error in most languages. A BOM at the top of a PHP file sends output before the headers and breaks sessions.
  • A JSON or CSV import fails on one row with no obvious problem. The culprit is often a BOM at the start of the file or an NBSP where the parser expects a regular space.
  • A password with a trailing ZWSP works on the site where you created it and fails in an app that strips the character on paste.
  • Search finds nothing. Typing "Smith" into a filter will not match a name with a ZWSP in the middle of it, and neither will a regular expression that uses \s, because most engines do not treat the ZWSP as whitespace.

Spreadsheets are the worst offenders because the built-in TRIM function removes ordinary spaces only. In Excel and Google Sheets TRIM leaves an NBSP in place, so the standard cleanup advice does nothing. CLEAN removes control characters below code point 32, which covers tabs and line feeds but none of the characters in the table above.

Lines of text in a code editor on a monitor
Photo by Pixabay on Pexels

How to detect them

You cannot see them, so you need to measure or reveal them.

  1. Count the characters. Paste the text into a character counter. If "admin" reports six characters, one of them is hidden. The same trick works in a spreadsheet: compare LEN(A1) with the number of letters you can see.
  2. Switch on a visible-whitespace mode. VS Code, Sublime Text and most modern editors highlight unusual Unicode by default and show a warning tooltip. Word shows NBSPs as a small degree-like symbol when you turn on formatting marks.
  3. Use a regular expression. Searching for [​-‍⁠ ㅤ] will highlight every character on the list. Add ⠀ if you suspect the braille blank.
  4. Look at the bytes. In UTF-8 a ZWSP is the three bytes E2 80 8B and an NBSP is C2 A0. A hex view makes them impossible to miss.
  5. Move the cursor. The low-tech test: press the right arrow key through the word. If the cursor pauses on a step without moving, it just crossed a zero-width character.

How to remove them

For a one-off cleanup, paste the text into the Whitespace Remover and choose the option to strip zero-width and non-breaking characters; it handles the whole set in one pass and shows you how many it took out. If the text also carries fancy Unicode fonts, smart quotes or HTML, the Remove Text Formatting tool flattens all of that at the same time.

Inside a spreadsheet, a SUBSTITUTE chain works: =TRIM(SUBSTITUTE(SUBSTITUTE(A1,CHAR(160)," "),UNICHAR(8203),"")) replaces the NBSP with a normal space and deletes the ZWSP, then trims. (8203 is the decimal form of U+200B; 160 is U+00A0. To turn any other code point into the decimal number that UNICHAR expects, enter the hex digits in the Number Base Converter with the input base set to hexadecimal and read the decimal line.) Extend the chain for U+200C, U+200D and U+2060 if you still see mismatches.

In code, strip the characters at the boundary where text enters your system, not later. A single regular expression replace on form input, /[​-‍⁠]/g, prevents most of the lookup and login bugs described above. Leave the NBSP alone in that rule unless you are sure you do not need it; in user-facing prose it may be doing its job on purpose.

Do not strip joiners from text that contains emoji or Arabic, Persian, Hindi or other connected scripts. Removing a ZWJ turns a family emoji back into three separate faces, and removing a ZWNJ can change the spelling of a Persian word.

How hidden-message encoding works

Online "hidden text" tools use these characters for a small piece of steganography. The method is simple enough to do by hand.

  1. Take the secret message and convert each letter to its 8-bit binary code. The letter "H" is 01001000.
  2. Replace every 0 with one invisible character and every 1 with another. A common pairing is ZWSP for 0 and ZWNJ for 1, with a ZWJ as a separator between letters.
  3. Append the resulting string of invisible characters to any ordinary sentence, or sprinkle them between its words. The sentence looks unchanged.
  4. To read the message, extract only the hidden characters, map them back to bits, and decode eight bits at a time.

Hiding the five-letter word "hello" costs 5 × 8 = 40 hidden characters, or 44 with a separator between each pair of letters. A message that appears to be 20 characters long would report 64 characters to a counter, which is the quickest way to tell that something is hiding in it.

The scheme is not encryption. Anyone who suspects a hidden payload can decode it in seconds, and many platforms now strip zero-width characters from posts and comments, which destroys the message. Treat it as a party trick or a tamper-evident marker, not as a way to keep a secret.

A related and less friendly trick uses the Unicode tag characters (U+E0000 to U+E007F), which are also invisible, to smuggle instructions into text that an AI assistant will read. Good text-cleaning tools remove that block too, and it is one more reason to clean anything you paste from an untrusted source.

Where to go next

When you need a blank name or want to plant a hidden note, the Invisible Text Generator gives you each character by code point. When a lookup fails or code will not compile, run the text through the Whitespace Remover first and check the count. Both run in your browser and nothing you paste is uploaded.

Related guides: cleaning up pasted text.

Frequently asked questions

Why does my username look blank on some platforms?

A blank-looking username is usually made of Hangul filler characters (U+3164) or zero-width spaces. The platform accepted them because its validator saw letters, not empty space. Some apps render the filler as a narrow gap, others as nothing at all, and a few display a small box because their font has no glyph for it. If the name shows differently from platform to platform, that is why.

Does Excel TRIM remove non-breaking spaces?

No. TRIM in Excel and Google Sheets removes only the ordinary space character (code 32). A non-breaking space (code 160) and zero-width characters survive it, which is why a cleaned value can still fail a VLOOKUP. Use SUBSTITUTE to swap CHAR(160) for a normal space and to delete UNICHAR(8203) before trimming, or paste the column through a whitespace remover and copy it back.

How can I tell if text contains zero-width characters?

Count it. Paste the text into a character counter and compare the total with the characters you can see; any surplus is hidden. In an editor, turn on visible whitespace or search with a regular expression that matches the U+200B to U+200D range plus U+2060 and U+FEFF. Stepping through the text with the arrow key also works: the cursor pauses without moving when it crosses an invisible character.

Are zero-width characters dangerous?

Not by themselves. They are ordinary Unicode and cannot run code. The risk is confusion: two strings that look the same but compare differently, a hidden watermark that reveals who leaked a document, or invisible instructions planted in text meant for an AI assistant. Strip them from anything pasted from an untrusted source before it reaches a database, login form or script.

What is the difference between a zero-width space and a non-breaking space?

They are near opposites. A zero-width space has no width and tells software that a line may break there, which is useful inside long URLs. A non-breaking space has the width of a normal space and tells software that a line must not break there, which keeps a number and its unit together. The word joiner combines the two ideas: no width and no break.

Try the tools from this guide

Keep reading

Related guides

All guides