HomeDevText & encodingASCII code for Space
Text tools

ASCII code for Space

ASCII code for the Space character is 32 (decimal). Hex, binary, HTML entities, non-breaking space (160), and how to type space characters.

ASCII space character specification

Version 1.0.0 · Last reviewed 2026-07-28

Definition
The Space character is ASCII code 32 (0x20). A non-breaking space (NBSP) is code 160 / U+00A0 and is outside 7-bit ASCII.
What it calculates
Documents the ASCII Space character (decimal 32) and contrasts it with the non-breaking space (160 / U+00A0).
Inputs
  • Reference lookup for Space (32) and NBSP (160)
Outputs
  • Space: decimal 32 · hex 0x20 · binary 00100000 · HTML  
  • NBSP: decimal 160 · Unicode U+00A0 · HTML  
Formula
space = 32 = 0x20; NBSP = 160 = U+00A0 = ' '

The Space character (visible gap between words) has ASCII code 32. It is the first printable ASCII character after control codes 0–31.

ASCII codes for Space

Property Value
Character (space)
Decimal code 32
Hex code 20
Binary code 00100000
Octal code 40
Escape sequence \x20
HTML code  

Non-breaking space (NBSP)

A non-breaking space prevents line breaks at that position. It uses code 160 in extended ASCII / Latin-1:

Property Value
Character (non-breaking space)
Decimal code 160
Hex code A0
Binary code 10100000
Escape sequence \xA0
HTML code   or  
Unicode U+00A0

How to type

Method Space Non-breaking space
Keyboard Spacebar Alt+0160 (Windows)
HTML     or  
Unicode U+0020 U+00A0
C/C++ ' ' or \x20 \xA0

FAQ

What is the ASCII code for space?

Decimal 32, hexadecimal 0x20.

What is the difference between space and non-breaking space?

A regular space (32) allows line wrapping. A non-breaking space (160) keeps adjacent words on the same line.

Can I see a space character in hex editors?

Yes. It appears as byte 0x20. Multiple consecutive spaces are multiple 0x20 bytes.

How do I type a non-breaking space in HTML?

Use   or the numeric entity  .

Is tab the same as space?

No. Tab is ASCII 9 (HT — horizontal tab). Space is ASCII 32.

Assumptions
  • Space (32) is the first printable ASCII character after controls 0–31.
  • NBSP is Latin-1 / Unicode, not 7-bit ASCII.
  • Reference page; encodings follow ASCII / Unicode / HTML.
Units
  • Dec / Hex / Bin
  • HTML entity
Boundary conditions
  • Multiple spaces may collapse in HTML unless preserved with CSS or <pre>.
  • NBSP prevents line wrapping at that position.
Example
' ' → 32 / 0x20 / 00100000; NBSP → 160 / U+00A0
Validation cases
  • Space → 32 / 0x20 / 00100000
  • NBSP → 160 / U+00A0 / &nbsp;
  • Tab → 9 / 0x09 (different character)
Sources
  • ANSI X3.4 / ISO/IEC 646 ASCII
  • Unicode Standard (Basic Latin / Latin-1 Supplement where applicable)
Last reviewed
2026-07-28
Calculation version
1.0.0