ASCII 56
Digit 8 (8)
Printable ASCII
The digit eight. ASCII code 56. Not a valid octal digit. One byte holds 8 bits, which is why extended ASCII tops out at 255 (2^8 - 1).
Common uses & context
The character '8' — the digit 8 — has ASCII code 56 (0x38), not 8. This offset of exactly 48 between a digit's glyph and its numeric value is the single most common beginner trap in low-level text handling: the byte that draws '8' on screen is 56, while the number 8 is a different value entirely. The digit eight. ASCII code 56. Not a valid octal digit. One byte holds 8 bits, which is why extended ASCII tops out at 255 (2^8 - 1).
The ten digit characters '0'–'9' occupy the contiguous range 48–57, which makes digit handling cheap and branch-free. You can test whether a byte is a digit with c >= '0' && c <= '9', and recover its numeric value with c - '0' (equivalently c - 48). Parsing a whole number is then just value = value * 10 + (c - '0') for each character left to right. For '8', that means c - '0' yields 8.
All encodings at a glance
| Decimal | 56 |
| Hexadecimal | 0x38 |
| Octal | 0070 |
| Binary | 00111000 |
| HTML numeric entity | 8 |
| URL encoding | %38 |
| UTF-8 bytes | 0x38 |
Code snippets
JavaScript
String.fromCharCode(56); // "8"
56.toString(16); // "38"Python
chr(56) # '8'
ord(chr(56)) # 56
hex(56) # '0x38'HTML
8 <!-- numeric entity (no named entity for this character) -->Programming notes
- ▸Character-to-value: '8' - '0' = 8 (i.e. 56 - 48).
- ▸Digit test: c >= '0' && c <= '9' works because 0–9 are the contiguous codes 48–57.
- ▸Multi-digit parse step: value = value * 10 + (c - '0').
Frequently asked questions
What character is ASCII code 56?
ASCII code 56 is the character '8' (Digit 8). In hexadecimal it is 0x38, in octal 0070, and in binary 00111000.
What is 0x38 in ASCII?
Hexadecimal 0x38 equals decimal 56, which is the character '8' (Digit 8). To convert hex to ASCII yourself, read the two hex digits as a base-16 number (0x38 = 56) and look up that code point.
How do I write the character with code 56 in code?
In JavaScript use String.fromCharCode(56); in Python use chr(56); in HTML use the numeric entity 8. In a URL it is percent-encoded as %38, and in UTF-8 it is stored as the byte sequence 0x38.
Why is the digit '8' stored as 56 instead of 8?
Because '8' is a text character, not the number 8. Its ASCII code is 56; the numeric value 8 is separate. Subtract 48 (the code of '0') to convert the character to its value: '8' − '0' = 8.