Now that we’ve discussed how a binary number is represented, as well as some important reasons we use binary numbers, we might wonder how computers can convert binary numbers to decimal numbers (the numbers that we’re familiar with).

A good way to convert binary to decimal is to use what is known as the exponent method. Here we’ll say for a binary digit with n digits, the resulting decimal number will be equal to:

i=0n1(di)2i\sum_{i=0}^{n-1} (d_{i}) * 2^{i}

where d is the value of the digit at position i, 0 or 1 in binary. Remember, we count from right to left with digits, so digit 0 will be furthest to the right. Thus, if we wanted to convert the binary value 0b1011 to decimal, we would end up with the expanded sum:

1(20)+1(21)+0(22)+1(23)=1+2+0+8=111(2^0) + 1(2^1) + 0(2^2) + 1(2^3) = 1 + 2 + 0 + 8 = 11

As you’ll quickly notice, in binary, an odd number always ends with a one. We only have two choices. Consider the number “3.” If we take away the even part, a “1” remains. This fact is true for all number bases.



If I see the binary number 0b111001110010, is it even or odd?

Assign "even" or "odd" to checkpoint_1 in the code editor.


Base 5 is the quinary system, composed of the numerals 0, 1, 2, 3, 4. The rules for evenness or oddness are the same regardless of the number base. In the quinary system, is “4” even or odd?

Assign "even" or "odd" to checkpoint_2 in the code editor.


Convert the binary number 0b110011 to decimal.

Assign the value to checkpoint_3 in the code editor. Remember to include any necessary prefix.


Convert the binary number 0b10010110 to decimal.

Assign the value to checkpoint_4 in the code editor. Remember to include any necessary prefix.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?