The digit 2 in binary code

AnswerThe digit 2 2 is 00110010 in binary — ASCII code 50.

012806413211608041201

How the digit 2 becomes 00110010

The character’s code is 50. Writing 50 as a sum of powers of two gives 32 + 16 + 2 = 50. Put a 1 under each place value used and a 0 everywhere else, and you get 00110010.

Binary (8-bit)00110010
Decimal (ASCII code)50
Hexadecimal32 (0x32)
Octal062
UnicodeU+0032
HTML entity2

Frequently asked questions

What is the digit 2 in binary?

The digit 2 is 00110010 in 8-bit binary. That is ASCII and UTF-8 code 50, which is 32 + 16 + 2 = 50.

Is the character 2 the same as the number 2 in binary?

No. The number 2 is 10 in binary, but the text character “2” is ASCII code 50, stored as 00110010. Subtract 48 (00110000) from a digit character to get its numeric value.