Space Character in ASCII and Unicode: Codes, Variants and Safe Use

The space character is ASCII 32 (hex 20) and Unicode U+0020. Learn how other Unicode spaces differ and when swapping them affects copying, search and accessibility.

The ordinary space is one of the most common characters in text, but it is also one of the hardest to inspect because it has no visible glyph. This guide identifies the standard space by its ASCII and Unicode codes, explains how it differs from the many other space-like characters in Unicode, and helps you judge whether replacing or transforming spaces in a text workflow keeps the result readable and usable.

Is the space an ASCII character?

Yes. The space is part of the original 7-bit ASCII set. It sits at decimal 32, the first position after the 32 control codes (0 to 31), and it is generally classed as a printable character even though it draws nothing. Unicode kept the ASCII range unchanged, so the same character is U+0020 SPACE in Unicode, and in UTF-8 it is stored as the single byte 0x20, identical to its ASCII byte.

Space character codes at a glance

Representation | Value
ASCII decimal | 32
Hexadecimal | 0x20
Octal | 040
Binary (7-bit) | 0100000
Unicode code point | U+0020 (name: SPACE)
UTF-8 bytes | 20
UTF-16 code unit | 0020
HTML numeric reference | or
URL percent-encoding | %20 (form encoding may use +)

You can confirm the code point yourself in most programming environments. The following snippets are standard language behavior rather than results from a specific tool:

# Python
ord(' ')          # 32
hex(ord(' '))     # '0x20'
' '.encode('utf-8')  # b' '

// JavaScript
' '.charCodeAt(0)              // 32
' '.codePointAt(0).toString(16) // '20'

Space in Unicode: more than one character

Unicode defines a family of space characters beyond U+0020. Most belong to the general category Zs (space separator) and differ in width or line-breaking behavior. A few related characters have zero width and are not classified as whitespace at all. Because they all look blank, a code point inspector is the reliable way to tell them apart.

Code point | Name | Key behavior
U+0020 | SPACE | Standard word separator; line breaks allowed; consecutive spaces collapse in default HTML rendering
U+00A0 | NO-BREAK SPACE | Same role as a space but prevents a line break; does not collapse in HTML; entity  
U+2002 | EN SPACE | Fixed width, nominally half an em
U+2003 | EM SPACE | Fixed width, nominally one em
U+2007 | FIGURE SPACE | Width of a digit; non-breaking; used to align numbers
U+2009 | THIN SPACE | Narrow space, often used in typography
U+200A | HAIR SPACE | Narrowest of the typographic spaces
U+202F | NARROW NO-BREAK SPACE | Thin and non-breaking; used in some number and unit conventions
U+3000 | IDEOGRAPHIC SPACE | Full-width space used with CJK text
U+200B | ZERO WIDTH SPACE | No visible width; marks a possible break point; category Cf, not Zs
U+FEFF | ZERO WIDTH NO-BREAK SPACE | Mainly used as a byte order mark; avoid as a spacing character

Actual rendered widths depend on the font, since the standard describes nominal widths and many fonts approximate or omit some of these characters.

What a space transformation actually changes

When a tool converts regular spaces to another space character, it changes the stored code points, not just the appearance. Copying the result carries the substituted characters with it. This is different from presentation changes such as CSS letter-spacing, word-spacing or white-space settings, which alter how text is displayed while leaving U+0020 in the underlying text.

The byte cost also changes. U+0020 is one byte in UTF-8, while U+00A0 takes two bytes (C2 A0) and characters such as U+2003, U+200B and U+3000 take three. This matters for systems with byte limits or for comparing files.

Other transformations interact with spaces in specific ways:

  • Character reversal keeps each space as a character and moves it to its mirrored position in the sequence; the space itself is unchanged.
  • Word reversal usually splits text on spaces, so a tool that only recognizes U+0020 may treat words joined by a no-break or ideographic space as a single word.
  • Mirrored or upside-down text substitutes look-alike letters, but the space has no glyph to mirror, so it typically passes through as U+0020.
  • Styled 'font' generators map letters to Unicode symbols such as mathematical alphanumerics; Unicode has no styled space in those ranges, so spaces normally remain ordinary U+0020.
  • In bidirectional text, the space is a neutral character, so its displayed position between right-to-left and left-to-right runs depends on the surrounding characters rather than on the space itself.

Will the result stay usable after copying or sharing?

Substituted spaces generally survive copy and paste as their own code points, which is both the point and the risk. Software that searches, splits or validates text may treat them differently from a regular space. Standard library behavior illustrates the split:

# Python
'\u00a0'.isspace()   # True  (no-break space counts as whitespace)
'\u200b'.isspace()   # False (zero width space does not)
'a\u00a0b'.split(' ') # ['a\xa0b'] - not split on U+0020

// JavaScript
/\s/.test('\u00a0')  // true
/\s/.test('\u200b')  // false

Practical consequences of these differences include:

  • Search: a query typed with a normal space may not match text that contains a no-break or ideographic space, depending on whether the search system normalizes whitespace.
  • Editing: code, spreadsheets and form validators can reject or misparse unusual spaces; a stray no-break space in source code is a common cause of confusing syntax errors.
  • Zero-width characters: U+200B and U+FEFF are invisible, so they can break matching, inflate character counts or alter usernames and identifiers without any visible sign.
  • Accessibility: screen readers are designed to read words, and ordinary or no-break spaces between real words generally do not change that. How a given screen reader handles zero-width or unusual typographic spaces was not tested for this article, so verify with the assistive technology your audience uses.
  • Rendering: if a font lacks a particular space character, the system may substitute a fallback or display a placeholder box.

No platform-specific tests were supplied for this article, so it makes no claims about how any particular social network, messaging app, CMS or screen reader handles these characters. If a destination matters, paste a sample, inspect the result with a code point viewer, and check that search and editing still behave as expected there.

Is a space transformation suitable for your use?

Replacing spaces is worth it when you need a specific behavior that U+0020 cannot provide: a no-break space to keep a number with its unit or a name on one line, a figure space to align digits, a thin space for typographic spacing, or an ideographic space in CJK text. The decisive tradeoff is that every substitution makes the text less predictable for software that expects plain ASCII spaces.

Keep the plain U+0020 space for code, data files, URLs, filenames, usernames, form input, searchable content and anything another system will parse. Avoid zero-width characters as spacing entirely unless you have a clear technical reason. For presentation-only spacing on web pages, CSS is usually a safer choice than changing the characters, because the stored text stays plain and copies cleanly.

Identifying an unknown space

If text contains a gap that behaves oddly, paste it into a Unicode inspector or print the code points programmatically. A value of 20 confirms the ordinary ASCII space; anything else, such as A0, 2009 or 200B, tells you which character is present and lets you decide whether to keep it or normalize it back to U+0020.

# Python: list the code point of every character
for ch in text:
    print(f'U+{ord(ch):04X}', repr(ch))