The digit 4 in binary code
AnswerThe digit 4 4 is 00110100 in binary — ASCII code 52.
012806413211608140201
How the digit 4 becomes 00110100
The character’s code is 52. Writing 52 as a sum of powers of two gives 32 + 16 + 4 = 52. Put a 1 under each place value used and a 0 everywhere else, and you get 00110100.
| Binary (8-bit) | 00110100 |
|---|---|
| Decimal (ASCII code) | 52 |
| Hexadecimal | 34 (0x34) |
| Octal | 064 |
| Unicode | U+0034 |
| HTML entity | 4 |
Frequently asked questions
What is the digit 4 in binary?
The digit 4 is 00110100 in 8-bit binary. That is ASCII and UTF-8 code 52, which is 32 + 16 + 4 = 52.
Is the character 4 the same as the number 4 in binary?
No. The number 4 is 100 in binary, but the text character “4” is ASCII code 52, stored as 00110100. Subtract 48 (00110000) from a digit character to get its numeric value.