Binary to Decimal Conversion: The Complete Guide
Binary is the language of computers, using only 0s and 1s to represent all data. Understanding how to convert between binary and decimal is fundamental to computer science and programming.
Understanding Binary
In the decimal system (base 10), each digit position represents a power of 10. In binary (base 2), each position represents a power of 2.
Powers of 2: 128, 64, 32, 16, 8, 4, 2, 1
(2^7, 2^6, 2^5, 2^4, 2^3, 2^2, 2^1, 2^0)
(2^7, 2^6, 2^5, 2^4, 2^3, 2^2, 2^1, 2^0)
Binary to Decimal Conversion
To convert binary to decimal, multiply each bit by its position value and add them up.
Example: Convert 10110101 to decimal
128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181
| Position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Power of 2 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Binary digit | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
| Value | 128 | 0 | 32 | 16 | 0 | 4 | 0 | 1 |
128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 181
Decimal to Binary Conversion
Use the division method: repeatedly divide by 2 and track the remainders.
Example: Convert 181 to binary
181 ÷ 2 = 90 remainder 1
90 ÷ 2 = 45 remainder 0
45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read remainders from bottom to top: 10110101
181 ÷ 2 = 90 remainder 1
90 ÷ 2 = 45 remainder 0
45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read remainders from bottom to top: 10110101
Quick Reference Chart
| Decimal | Binary | Decimal | Binary |
|---|---|---|---|
| 0 | 0000 | 8 | 1000 |
| 1 | 0001 | 9 | 1001 |
| 2 | 0010 | 10 | 1010 |
| 3 | 0011 | 11 | 1011 |
| 4 | 0100 | 12 | 1100 |
| 5 | 0101 | 13 | 1101 |
| 6 | 0110 | 14 | 1110 |
| 7 | 0111 | 15 | 1111 |
Binary in Computing
Binary is used everywhere in computers:
- 1 bit: A single 0 or 1
- 1 byte: 8 bits (can represent 0-255)
- 1 kilobyte: 1,024 bytes
- 1 megabyte: 1,048,576 bytes
Hexadecimal Shortcut
Programmers often use hexadecimal (base 16) because it's a compact way to represent binary. Each hex digit represents 4 binary digits:
| Hex | Binary | Hex | Binary |
|---|---|---|---|
| 0 | 0000 | 8 | 1000 |
| 1 | 0001 | 9 | 1001 |
| 2 | 0010 | A | 1010 |
| 3 | 0011 | B | 1011 |
| 4 | 0100 | C | 1100 |
| 5 | 0101 | D | 1101 |
| 6 | 0110 | E | 1110 |
| 7 | 0111 | F | 1111 |
Example: Binary to Hex
10110101 → Split into groups of 4: 1011 0101
1011 = B, 0101 = 5
Binary 10110101 = Hex B5
10110101 → Split into groups of 4: 1011 0101
1011 = B, 0101 = 5
Binary 10110101 = Hex B5
Convert Numbers Instantly
Use our free Number Base Converter!
Practice Problems
Try these conversions yourself:
- Binary 11001010 = ? (Answer: 202)
- Decimal 75 = ? (Answer: 1001011)
- Binary 11111111 = ? (Answer: 255)
- Decimal 128 = ? (Answer: 10000000)