Best uses
- Check programming, networking, electronics, or computer science examples.
- Convert base-2 homework problems step by step.
- Verify binary values before using them in code or documentation.
To convert a binary number to decimal, multiply each binary digit by the matching power of 2, then add the values together. In short: digit x 2position. The example below shows how the positions are counted:
| Binary Number: | 1 | 0 | 1 | 1 | . | 1 | 0 |
|---|---|---|---|---|---|---|---|
| Position of Digit: | 3 | 2 | 1 | 0 | . | -1 | -2 |
| Digit * power of 2: | 1*23 | 0*22 | 1*21 | 1*20 | . | 1*2−1 | 0*2−2 |
Imagine a binary number written as: dn-1 .... d4 d3 d2 d1 d0
The decimal value is the sum of each binary digit multiplied by the correct power of 2:
decimal = dn-1 x 2n-1 + .... + d1 x 21 + d0 x 20 + d-1 x 2-1 + .... + d-n x 2-n
Convert (1011.10)2 to decimal.
| binary number: | 1 | 0 | 1 | 1 | . | 1 | 0 |
|---|---|---|---|---|---|---|---|
| power of 2: | 23 | 22 | 21 | 20 | . | 2−1 | 2−2 |
=(1011.10)2
= 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 + 1 x 2-1 + 0 x 2-2
= 8 + 0 + 2 + 1 + .5 + 0
= (11.5)10
| Binary | Decimal |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 10 | 2 |
| 11 | 3 |
| 100 | 4 |
| 101 | 5 |
| 110 | 6 |
| 111 | 7 |
| 1000 | 8 |
| 1001 | 9 |
| 1010 | 10 |
| 1011 | 11 |
| 1100 | 12 |
| 1101 | 13 |
| 1110 | 14 |
| 1111 | 15 |
| 10000 | 16 |
| 10001 | 17 |
| 10010 | 18 |
| 10011 | 19 |
| 10100 | 20 |
Binary numbers use only 0 and 1. To convert binary to decimal, each digit is multiplied by a power of 2 based on its position, then the values are added.
1011 in binary equals 11 in decimal because it is 8 + 0 + 2 + 1.
Yes. Digits after the binary point use powers such as 2^-1, 2^-2, and 2^-3.