</>
character.codes
← Back to Learn

Whitespace Characters in Unicode: Spaces You Didn't Know Existed

Published March 15, 2025

More than just the space bar

Most developers think of whitespace as the space character, tab, and newline. But Unicode defines over 25 whitespace and space-related characters, each with a specific typographic or functional purpose. Understanding them helps you debug mysterious formatting issues, write better text processing code, and produce cleaner typography.

Common whitespace characters

NameCode pointHTMLNotes
SpaceU+0020Standard word separator
No-Break SpaceU+00A0&nbsp;Prevents line break
Character TabulationU+0009&#9;Horizontal tab
Line FeedU+000A&#10;Unix newline
Carriage ReturnU+000D&#13;Part of Windows CRLF

Typographic spaces

Unicode includes spaces of specific widths, inherited from traditional typesetting. Their names refer to the metal type units used in letterpress printing:

NameCode pointWidth
En SpaceU+2002Width of the letter “n”
Em SpaceU+2003Width of the letter “M”
Three-Per-Em SpaceU+20041/3 of an em
Four-Per-Em SpaceU+20051/4 of an em
Six-Per-Em SpaceU+20061/6 of an em
Figure SpaceU+2007Width of a digit (for aligning numbers)
Punctuation SpaceU+2008Width of a period
Thin SpaceU+20091/5 of an em (roughly)
Hair SpaceU+200AThinnest typographic space

Zero-width characters

These characters take up no visible space but affect text processing and rendering:

NameCode pointPurpose
Zero Width SpaceU+200BMarks a possible line break point without visible space
Zero Width Non-JoinerU+200CPrevents ligature formation in scripts like Arabic and Devanagari
Zero Width JoinerU+200DRequests ligature or cursive joining; used in emoji ZWJ sequences
Word JoinerU+2060Prevents line break (like &nbsp; but zero-width)

The Zero Width Joiner (ZWJ) has become especially well-known through emoji. A ZWJ between two emoji requests that the platform render them as a single combined glyph, enabling sequences like 👩‍💻 (woman technologist = 👩 + ZWJ + 💻).

Visual comparison

Different spaces have different widths. Here each space type is shown between vertical bars so you can compare:

NameVisual width
Regular Space| |
No-Break Space| |
En Space| |
Em Space| |
Thin Space| |
Hair Space| |
Zero Width Space|​|

When each is useful

  • Non-breaking space (&nbsp;): keep “100 km” or “Dr. Smith” on the same line
  • Thin space: used as a thousands separator in French (1 000 000) and between values and units in SI notation (9.8 m/s²)
  • Figure space: aligning columns of numbers in plain text, since each figure space equals the width of a digit
  • Zero-width space: adding line break opportunities in long URLs or paths without visible changes
  • Word joiner: preventing line breaks at specific points (e.g., keeping a currency symbol attached to a number: $⁠100)

Debugging invisible characters

Invisible characters cause some of the most frustrating bugs — strings that look identical but don't match, or text that mysteriously won't parse. Here are strategies for finding them:

  • Show whitespace in your editor (VS Code: “Render Whitespace: all”, Vim: :set list)
  • Check string length: if str.length is longer than the visible characters, hidden characters are present
  • Log code points: in JavaScript, use [...str].map(c => c.codePointAt(0).toString(16)) to see every character as a hex code point
  • Use regex: match zero-width characters with /[\u200B-\u200D\u2060\uFEFF]/g