Number Bases and Binary Arithmetic
Why Computers Use Binary
Every piece of data inside a computer — text, images, sound, instructions — is ultimately stored and processed as a pattern of 1s and 0s. This is the binary (base-2) number system. A transistor in a chip is either conducting electricity or not — that two-state physical reality maps perfectly onto binary’s two digits. Every other number system we use in computing is ultimately a convenient way of writing or working with binary data.
Place Values in Binary
Just as denary (decimal, base-10) uses place values of 1, 10, 100, 1000…, binary uses place values that are powers of 2. For an 8-bit number, the place values from left (most significant) to right (least significant) are:
128 — 64 — 32 — 16 — 8 — 4 — 2 — 1
The maximum 8-bit value is 11111111, which equals 128+64+32+16+8+4+2+1 = 255. An 8-bit binary number can therefore represent any whole number from 0 to 255.
An 8-bit binary number has place values 128, 64, 32, 16, 8, 4, 2, 1 (left to right). To convert binary to denary, add up the place values where the digit is 1. The maximum 8-bit value is 11111111 = 255. Decimal values from 0 to 255 must be representable.
Binary → Denary: Convert 10110010
Write out place values and match each bit:
128: 1 → 128
64: 0 → 0
32: 1 → 32
16: 1 → 16
8: 0 → 0
4: 0 → 0
2: 1 → 2
1: 0 → 0
Total: 128 + 32 + 16 + 2 = 178
Denary → Binary: Convert 157
128 fits: 157 − 128 = 29, write 1
64 does not fit in 29, write 0
32 does not fit in 29, write 0
16 fits: 29 − 16 = 13, write 1
8 fits: 13 − 8 = 5, write 1
4 fits: 5 − 4 = 1, write 1
2 does not fit in 1, write 0
1 fits: 1 − 1 = 0, write 1
Result: 10011101
Hexadecimal
Hexadecimal (hex, base-16) uses 16 symbols: digits 0–9 and letters A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. The maximum 8-bit value in hex is FF (both nibbles at maximum). Hex is widely used because it is a compact shorthand for binary: every four bits (one nibble) maps to exactly one hex digit, making long binary strings much easier for humans to read.
You will see hex everywhere: web colour codes (#FF5500), MAC addresses on network cards, memory dump listings in diagnostic tools. Computers do not process hex directly — it is a human convenience for representing binary concisely.
Binary → Hex: Convert 11001010
Split into nibbles: 1100 | 1010
1100 = 12 = C
1010 = 10 = A
Result: CA
Hex → Denary: Convert CA
C = 12; A = 10
(12 × 16) + 10 = 192 + 10 = 202
Denary → Hex: Convert 200
200 ÷ 16 = 12 remainder 8
12 = C, 8 = 8
Result: C8
Check: (12 × 16) + 8 = 192 + 8 = 200 ✓
To convert binary to hex: split into groups of 4 bits (nibbles) from the right, then convert each nibble to its hex digit. The maximum 8-bit value is FF in hex, 255 in denary. To convert hex to denary: multiply the first digit by 16 and add the second.
Units of Information
A single binary digit is called a bit. Eight bits together form a byte. The convention on this course uses the SI decimal prefixes — not powers of 2:
- kilobyte (kB) = 1,000 bytes
- megabyte (MB) = 1,000 kilobytes
- gigabyte (GB) = 1,000 megabytes
- terabyte (TB) = 1,000 gigabytes
Note: you may have seen the prefix “kibi” (KiB = 1,024 bytes) used in some contexts, but this course uses the decimal SI convention only. Do not write 1 kB = 1,024 bytes in your exam answers.
Binary Addition
Binary addition follows four simple rules: 0+0=0; 1+0=1; 1+1=0 carry 1; 1+1+1=1 carry 1. The exam will ask you to add up to three 8-bit numbers in a single column, meaning the maximum number of 1s in any column is three. Answers stay within 8 bits — exam questions will not require carrying beyond the eighth bit.
Add 01110011 (115) and 00101100 (44):
01110011 + 00101100 ---------- 10011111
Working right to left:
Col 1: 1+0 = 1
Col 2: 1+0 = 1
Col 3: 0+1 = 1
Col 4: 0+1 = 1
Col 5: 1+0 = 1
Col 6: 1+1 = 0 carry 1
Col 7: 1+0+carry1 = 0 carry 1
Col 8: 0+0+carry1 = 1
Result: 10011111 = 159. Check: 115 + 44 = 159 ✓
Binary Shifts
A binary shift moves every bit in a number left or right by a stated number of positions. Bits that move beyond the 8-bit boundary are lost. Empty positions are filled with 0.
A left shift by 1 multiplies the value by 2. A left shift by 2 multiplies by 4. A right shift by 1 divides by 2 (integer division — any remainder is lost). A right shift by 2 divides by 4.
Example: 00001100 (12) left-shifted by 2 → 00110000 = 48. Check: 12 × 4 = 48. Right-shifted by 1 → 00000110 = 6. Check: 12 ÷ 2 = 6. Binary shifts are used in image processing, audio signal scaling, and efficient arithmetic in embedded systems where multiplying by a power of 2 is extremely common.