Bits & Bytes
Storage and memory are measured in bytes, and each byte is just eight binary positions.
Base-2
Binary uses only 0 and 1, making it the native language of digital systems. Every byte, flag, permission bit, and machine instruction starts from this idea.
Storage and memory are measured in bytes, and each byte is just eight binary positions.
Read, write, execute, flags, and masks are often toggled as individual binary states.
IPv4 masks, subnetting, and packet flags become much easier once binary place values make sense.
Binary helps explain how processors, memory, file formats, and encodings are represented under the hood.
Each binary digit contributes based on its power of two. This four-bit example uses 10112; a full byte uses the eight weights shown below.
Eights
2 to the power of 3
Value:8
1 × 8 = 8
Fours
2 to the power of 2
Value:4
0 × 4 = 0
Twos
2 to the power of 1
Value:2
1 × 2 = 2
Ones
2 to the power of 0
Value:1
1 × 1 = 1
10112
1 × 8 + 0 × 4 + 1 × 2 + 1 × 1
8 + 0 + 2 + 1 = 1110
Why It Helps
A 1 includes its place value and a 0 contributes nothing. Add the included values to convert a binary number into decimal.
To represent 42, work from the largest byte weight downwards. Neither 128 nor 64 fits. Include 32, leaving 10. Skip 16, include 8, then include 2. Put a 1 in those positions and a 0 in the others.
42 = 32 + 8 + 2
0010 10102 = 4210
Eight bits have 28 = 256 different patterns. As unsigned whole numbers these run from 0 to 255. The leading zeros in 00101010 keep the eight-bit width; 101010 has the same value. Binary itself is not limited to a byte: 256 requires nine bits.
Divide 13 by two repeatedly, recording each whole-number quotient and remainder. Stop when the quotient is zero.
| Division | Quotient | Remainder |
|---|---|---|
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Read the remainders from the bottom upwards: 1101. Check with place values: 8 + 4 + 1 = 13. The first remainder is the rightmost, least significant bit.
Predict the bits first, then enter a whole decimal value from 0 to 255 to check its unsigned byte and hexadecimal forms.
Binary
00101010
Hex
2A
Decimal 42 is binary 00101010 and hexadecimal 2A.
Each position in a byte represents a power of two.
2 to the power of 7
128
2 to the power of 6
64
2 to the power of 5
32
2 to the power of 4
16
2 to the power of 3
8
2 to the power of 2
4
2 to the power of 1
2
2 to the power of 0
1
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 2 |
| 3 | 0011 | 3 |
| 4 | 0100 | 4 |
| 5 | 0101 | 5 |
| 6 | 0110 | 6 |
| 7 | 0111 | 7 |
| 8 | 1000 | 8 |
| 9 | 1001 | 9 |
| (10) | 1010 | A |
| (11) | 1011 | B |
| (12) | 1100 | C |
| (13) | 1101 | D |
| (14) | 1110 | E |
| (15) | 1111 | F |
Write the eight-bit patterns for 13, 64, and 170 on paper. For each answer, add the active weights back to decimal. Then use Binary Demo to test your predictions, or Build the Byte without a target hint.
Success means you can explain which weights you selected, as well as produce the right pattern. Next, groups of three bits become octal digits and groups of four become hexadecimal digits.
Try these without the converter or reference table. Check each answer to reveal its explanation.