Req 4b — Binary & Decimal Conversion
In Req 4a, you learned that digital electronics speak in binary — a number system with only two digits: 0 and 1. Now you need to become fluent in translating between the decimal system (the base-10 system you use every day) and binary (the base-2 system that every computer uses internally).
Why Binary Matters
Computers use binary because transistors — the tiny switches inside every chip — have two states: on (1) and off (0). A single binary digit is called a bit. Eight bits grouped together form a byte, which can represent any number from 0 to 255. Every number, letter, color, and sound in a computer is ultimately stored as a pattern of bits.
Understanding Place Values
The key to conversion is understanding place values. In the decimal system, each position is worth 10 times more than the one to its right:
| Position | Thousands | Hundreds | Tens | Ones |
|---|---|---|---|---|
| Place value | 1000 | 100 | 10 | 1 |
| Power of 10 | 10^3 | 10^2 | 10^1 | 10^0 |
Binary works the same way, but each position is worth 2 times more than the one to its right:
| Position | 128s | 64s | 32s | 16s | 8s | 4s | 2s | 1s |
|---|---|---|---|---|---|---|---|---|
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Power of 2 | 2^7 | 2^6 | 2^5 | 2^4 | 2^3 | 2^2 | 2^1 | 2^0 |
Decimal to Binary — The Division Method
To convert a decimal number to binary, repeatedly divide by 2 and record the remainders. Read the remainders from bottom to top.
Example: Convert 42 to binary
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 42 / 2 | 21 | 0 |
| 2 | 21 / 2 | 10 | 1 |
| 3 | 10 / 2 | 5 | 0 |
| 4 | 5 / 2 | 2 | 1 |
| 5 | 2 / 2 | 1 | 0 |
| 6 | 1 / 2 | 0 | 1 |
Reading the remainders from bottom to top: 42 in decimal = 101010 in binary.
Example: Convert 13 to binary
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 13 / 2 | 6 | 1 |
| 2 | 6 / 2 | 3 | 0 |
| 3 | 3 / 2 | 1 | 1 |
| 4 | 1 / 2 | 0 | 1 |
Reading bottom to top: 13 = 1101
Example: Convert 200 to binary
| Step | Division | Quotient | Remainder |
|---|---|---|---|
| 1 | 200 / 2 | 100 | 0 |
| 2 | 100 / 2 | 50 | 0 |
| 3 | 50 / 2 | 25 | 0 |
| 4 | 25 / 2 | 12 | 1 |
| 5 | 12 / 2 | 6 | 0 |
| 6 | 6 / 2 | 3 | 0 |
| 7 | 3 / 2 | 1 | 1 |
| 8 | 1 / 2 | 0 | 1 |
Reading bottom to top: 200 = 11001000
Binary to Decimal — The Addition Method
To convert binary to decimal, write out the place values above each bit, then add up the place values wherever you see a 1.
Example: Convert 110101 to decimal
| Place value | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|
| Binary digit | 1 | 1 | 0 | 1 | 0 | 1 |
Add the place values where the digit is 1: 32 + 16 + 4 + 1 = 53
Example: Convert 10010 to decimal
| Place value | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|
| Binary digit | 1 | 0 | 0 | 1 | 0 |
Add: 16 + 2 = 18
Example: Convert 11111111 to decimal
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Binary digit | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Add: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255
Quick Check — Place Value Method for Decimal to Binary
There is a faster method that some people prefer. Start with the largest power of 2 that fits into your number, subtract it, and continue:
Convert 45 to binary:
- 45 >= 32? Yes. Write 1. Remainder: 45 - 32 = 13
- 13 >= 16? No. Write 0.
- 13 >= 8? Yes. Write 1. Remainder: 13 - 8 = 5
- 5 >= 4? Yes. Write 1. Remainder: 5 - 4 = 1
- 1 >= 2? No. Write 0.
- 1 >= 1? Yes. Write 1. Remainder: 0
Result: 45 = 101101
