1.Why should I care?
Registers, memory addresses, colours and network packets are all written in binary or hex. Fluent conversion is the everyday language of anyone who works close to the hardware.
- ◇ Convert between decimal, binary and hexadecimal using place values.
- ◇ State the range of values n bits can hold (0 to 2ⁿ − 1).
- ◇ Explain why engineers write long binary numbers in hex.
2.Watch
→ Watch for place values doubling from right to left, and how the same idea stretches to letters and colours.
Shows how ones and zeros can stand for numbers and text, so binary stops feeling like magic.
10 min 45 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
The video is optional: everything you need is also in the lesson text and the interactive.
3.Predict
What is the largest number you can store in 8 bits?
Guess first. Being wrong here is how the surprise works.
4.Discover
Do Level 1 of the virtual computer: show 13, 6 and 9 on the 4-bit register, turn 1010 and 0111 back into numbers, find the largest 4-bit number, and predict what 1111 + 1 shows.
Can't use the interactive? Read a description instead
In the virtual computer's 4-bit register, lamps show the bits: 13 is 1101, 6 is 0110 and 9 is 1001; 1010 is 10 and 0111 is 7. The largest 4-bit number is 15 (1111), and adding 1 to 1111 gives 0000 because the carry falls off the top.
5.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1
What is binary 1011 in decimal?
Practice 2 · a fresh version every time
What is the binary number 11010011 in decimal?
6.Understand
Place values that double
In binary each place is worth twice the one to its right: 1, 2, 4, 8, 16, 32, 64, 128. 1011 = 8 + 0 + 2 + 1 = 11. To go the other way, take away the biggest power of 2 that fits and repeat: 13 = 8 + 4 + 1 = 1101.
How much fits
n bits make 2ⁿ patterns, holding 0 to 2ⁿ − 1. 4 bits: 0 to 15. 8 bits (a byte): 0 to 255. 16 bits: 0 to 65,535. Each extra bit doubles the range.
Hex: four bits per digit
Hexadecimal has 16 digits: 0–9 then A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. Each hex digit is exactly four bits, so a byte is two hex digits: 0x6B = 0110 1011 = 6 × 16 + 11 = 107. 0xFF = 255. The '0x' just marks a number as hex.
Explain it another way
Binary is counting with only two fingers per place. Hex is a shorthand that packs four of those places into one symbol, the way '1 dozen' packs twelve eggs.
A positional system in base b represents Σ dₖ·bᵏ. Since 16 = 2⁴, each hex digit maps to a fixed 4-bit group (a nibble), making conversion a lookup rather than arithmetic.
0x2A = 2 × 16 + 10 = 42 = 0010 1010. 200 = 128 + 64 + 8 = 1100 1000 = 0xC8.
Colours on web pages are three bytes in hex: #FF8000 is full red, half green, no blue. Debuggers show memory in hex because each pair of digits is one byte.
Worked example 1
Convert 0xC8 to binary and decimal.
C = 12 = 1100 and 8 = 1000, so 1100 1000. Decimal: 12 × 16 + 8 = 200.
Common mix-ups
- 8 bits can hold numbers up to 256.
✓ 8 bits make 256 patterns, but they start at 0, so the largest is 255. - Hex is a different kind of number.
✓ It is the same number written in base 16; only the notation changes.
7.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 3 · a fresh version every time
What is the hexadecimal number 85 (0x85) in decimal?
Practice 4
What is 0x2A in decimal?
Practice 5
What is the largest value a 16-bit unsigned number can hold?
8.Apply it
Complete BUILD 008 Level 1. Then write your age, the day of the month and 200 in binary and in hex, and check each with the 4-bit or 8-bit register in the adder stepper.
9.Reflect
Concepts: Binary, hexadecimal and digital signals