Binary Practice Workbook
Companion to Binary: The Language of Addresses (Module 4). Work with pencil and paper — no calculator. Fluency here is what makes every subnetting problem in this module fast instead of painful.
The method: 128 · 64 · 32 · 16 · 8 · 4 · 2 · 1
An IPv4 address is 32 bits shown as four octets (groups of 8 bits), each written as a decimal number from 0 to 255. Every bit position in an octet has a fixed value. Memorize this header row — it is the only thing to memorize:
128 64 32 16 8 4 2 1
Binary → decimal: write the 8 bits under the header and add the values that sit above each 1. That is the whole trick.
Decimal → binary: walk the header left to right. At each position ask "does this value fit into what I have left?" If yes, write 1 and subtract it; if no, write 0 and move on. A correct conversion always ends with 0 left over.
Instant self-checks: all eight 1s = 255; all 0s = 0; every answer must land between the two. An odd number always ends in 1; an even number always ends in 0.
Worked examples
Example 1 — binary → decimal: 10100110
128 64 32 16 8 4 2 1
1 0 1 0 0 1 1 0
Add the values above the 1s: 128 + 32 + 4 + 2 = 166.
Example 2 — decimal → binary: 172
| Ask | Fits? | Bit | Left over |
|---|---|---|---|
| 128 into 172? | yes | 1 | 44 |
| 64 into 44? | no | 0 | 44 |
| 32 into 44? | yes | 1 | 12 |
| 16 into 12? | no | 0 | 12 |
| 8 into 12? | yes | 1 | 4 |
| 4 into 4? | yes | 1 | 0 |
| 2 into 0? | no | 0 | 0 |
| 1 into 0? | no | 0 | 0 |
Result: 10101100. (That 172 opens the private block 172.16.0.0/12 — you will meet it again in this module.)
Example 3 — a mask octet: /26
A subnet mask is always unbroken 1s followed by unbroken 0s. A /26 mask has 26 ones: three full octets (24 bits) plus two more at the start of the fourth:
11000000 → 128 + 64 = 192 so /26 = 255.255.255.192
Because the 1s never have gaps, only nine values can ever appear in a mask octet: 0, 128, 192, 224, 240, 248, 252, 254, 255. If you compute anything else, a bit slipped.
Before Set C: hexadecimal in four lines
Hex has sixteen digits: 0–9, then A=10, B=11, C=12, D=13, E=14, F=15. One hex digit is exactly 4 bits, so two hex digits are one octet. Two-digit hex → decimal: (first digit × 16) + second digit. MAC addresses are twelve hex digits (3C:52:82:1B:04:9F) and IPv6 groups are four (2001:0db8:…) — same bits, shorter spelling.
Exercises
Finish a whole set before opening the key. Write all 8 bits, leading zeros included — routers do.
Set A — binary → decimal
A1. 00000101 · A2. 00001111 · A3. 00100000 · A4. 01010101 · A5. 10000001 A6. 10101010 · A7. 11000000 · A8. 11001000 · A9. 11100100 · A10. 11111101
Set B — decimal → binary
B1. 7 · B2. 12 · B3. 25 · B4. 63 · B5. 100 B6. 130 · B7. 168 · B8. 192 · B9. 224 · B10. 249
Set C — mixed (hex joins in)
C1. Binary → decimal: 10111111 C2. Decimal → binary: 254 C3. Hex → decimal: 1A C4. Hex → decimal: C8 C5. Decimal → hex: 61 C6. Decimal → hex: 240 C7. Hex → binary (8 bits): 2F C8. Binary → hex: 11010110 C9. A mask octet has 5 network bits and 3 host bits. Write it in binary and in decimal. C10. A MAC address begins with the octet 3C. Give it in decimal and in binary.
Answer key
Set A
| # | Answer | The sum |
|---|---|---|
| A1 | 5 | 4+1 |
| A2 | 15 | 8+4+2+1 |
| A3 | 32 | 32 |
| A4 | 85 | 64+16+4+1 |
| A5 | 129 | 128+1 |
| A6 | 170 | 128+32+8+2 |
| A7 | 192 | 128+64 |
| A8 | 200 | 128+64+8 |
| A9 | 228 | 128+64+32+4 |
| A10 | 253 | 128+64+32+16+8+4+1 |
Set B
| # | Answer | Check (add it back) |
|---|---|---|
| B1 | 00000111 | 4+2+1 = 7 |
| B2 | 00001100 | 8+4 = 12 |
| B3 | 00011001 | 16+8+1 = 25 |
| B4 | 00111111 | 32+16+8+4+2+1 = 63 |
| B5 | 01100100 | 64+32+4 = 100 |
| B6 | 10000010 | 128+2 = 130 |
| B7 | 10101000 | 128+32+8 = 168 |
| B8 | 11000000 | 128+64 = 192 |
| B9 | 11100000 | 128+64+32 = 224 |
| B10 | 11111001 | 128+64+32+16+8+1 = 249 |
Set C
- C1. 191 (128+32+16+8+4+2+1 — every value except 64).
- C2. 11111110 (255 minus the final 1).
- C3. 1A = (1×16)+10 = 26.
- C4. C8 = (12×16)+8 = 200.
- C5. 61 = 3×16 + 13 = 3D.
- C6. 240 = 15×16 + 0 = F0.
- C7. 2F → 2 = 0010, F = 1111 → 00101111.
- C8. 11010110 → 1101 = D, 0110 = 6 → D6 (decimal 214).
- C9. Five 1s then three 0s: 11111000 = 248 (128+64+32+16+8).
- C10. 3C = (3×16)+12 = 60; binary 00111100 (32+16+8+4).
Network Essentials · Module 4 · Turning Point Academy — backbone: Al-Doori, Network Essentials, Ch. 6.