Binary and Hexadecimal — GCSE Computer Science Complete Guide
Master binary and hexadecimal for GCSE Computer Science. Conversion methods, binary arithmetic, two's complement, and why hex is used — with worked examples and exam tips.
Gareth Edgell
Head of CS · Senior Examiner · 15+ years tutoring
Binary and hexadecimal are core topics in every GCSE Computer Science specification. This guide explains everything you need — from basic conversions to binary arithmetic — with step-by-step worked examples and examiner tips.
Why Do Computers Use Binary?
Computers use binary (base 2) because they’re built from electronic switches that can only be in one of two states: on (1) or off (0). This makes binary the natural language of hardware.
Hexadecimal (base 16) is used because it’s a compact, human-readable way to represent binary. Every 4 binary digits (bits) converts to exactly one hex digit — making it much easier to work with large binary numbers.
Number Systems
| System | Base | Digits used |
|---|---|---|
| Binary | 2 | 0, 1 |
| Denary (decimal) | 10 | 0–9 |
| Hexadecimal | 16 | 0–9, A–F |
In hexadecimal:
- A = 10
- B = 11
- C = 12
- D = 13
- E = 14
- F = 15
Binary to Denary Conversion
Use column headers (powers of 2), place the binary digits underneath, then add up the values where a 1 appears.
Example: Convert 10110101 to denary
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 |
128 + 32 + 16 + 4 + 1 = 181
Denary to Binary Conversion
Method 1: Division by 2 (remainders)
Divide by 2 repeatedly and read the remainders from bottom to top.
Convert 181 to binary:
181 ÷ 2 = 90 remainder 1
90 ÷ 2 = 45 remainder 0
45 ÷ 2 = 22 remainder 1
22 ÷ 2 = 11 remainder 0
11 ÷ 2 = 5 remainder 1
5 ÷ 2 = 2 remainder 1
2 ÷ 2 = 1 remainder 0
1 ÷ 2 = 0 remainder 1
Read remainders bottom to top: 10110101 ✓
Method 2: Column subtraction
Write out column headers (128, 64, 32, 16, 8, 4, 2, 1) and subtract the largest power that fits:
181 – 128 = 53 → write 1 in the 128 column 53 – 32 = 21 → write 1 in the 32 column (64 is too big) 21 – 16 = 5 → write 1 in the 16 column 5 – 4 = 1 → write 1 in the 4 column 1 – 1 = 0 → write 1 in the 1 column
Result: 10110101 ✓
Hexadecimal Conversions
Binary to Hexadecimal
Split the binary number into groups of 4 bits (from the right), then convert each group to its hex digit.
Example: Convert 10110101 to hex
1011 0101
B 5
Answer: B5
Hexadecimal to Binary
Reverse the process — convert each hex digit to 4 bits.
Example: Convert 3F to binary
3 F
0011 1111
Answer: 00111111
Denary to Hexadecimal
Method: Divide by 16
Convert 181 to hex:
181 ÷ 16 = 11 remainder 5
11 ÷ 16 = 0 remainder 11 (= B)
Read remainders bottom to top: B5 ✓
Hexadecimal to Denary
Use column headers (powers of 16):
| 256 | 16 | 1 |
|---|---|---|
| B (11) | 5 |
(11 × 16) + (5 × 1) = 176 + 5 = 181 ✓
Binary Arithmetic
Binary Addition
Rules:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10 (write 0, carry 1)
- 1 + 1 + 1 = 11 (write 1, carry 1)
Example: Add 01101100 + 00110101
01101100
+ 00110101
----------
10100001
Working through from right to left:
- 0+1 = 1
- 0+0 = 0
- 1+1 = 10 (0, carry 1)
- 1+0+1(carry) = 10 (0, carry 1)
- 0+1+1(carry) = 10 (0, carry 1)
- 1+1+1(carry) = 11 (1, carry 1)
- 1+0+1(carry) = 10 (0, carry 1)
- 0+0+1(carry) = 1
Result: 10100001
Check: 108 + 53 = 161, and 10100001 = 128 + 32 + 1 = 161 ✓
Overflow
Overflow occurs when the result of a binary calculation is too large to be stored in the available number of bits.
With 8 bits, the maximum unsigned value is 255. If two numbers add up to more than 255, overflow occurs — the result is incorrect (the carry out of the most significant bit is lost).
Negative Numbers: Two’s Complement
GCSE specs require knowledge of how negative numbers are represented using two’s complement.
How two’s complement works
For an 8-bit number:
- The most significant bit (MSB) has a value of −128 (not +128)
- All other bits have their normal positive values
| −128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
Example: What is 11010110 in two’s complement?
−128 + 64 + 16 + 4 + 2 = −42
Converting a negative denary to two’s complement
Two-step method:
- Write the positive version in binary
- Flip all the bits (invert)
- Add 1
Example: Convert −42 to 8-bit two’s complement
Step 1: +42 in binary = 00101010 Step 2: Flip all bits = 11010101 Step 3: Add 1 = 11010110 ✓
Why two’s complement?
Two’s complement lets computers use the same addition circuit for both addition and subtraction. To subtract 42, add its two’s complement — no separate subtraction circuit needed.
Character Encoding
ASCII
ASCII (American Standard Code for Information Interchange) maps characters to 7-bit binary values (extended to 8-bit/1 byte in practice).
Key values to remember:
- ‘A’ = 65 (01000001)
- ‘a’ = 97 (01100001)
- ‘0’ = 48 (00110000)
- Space = 32
Note: lowercase letters have ASCII values 32 greater than their uppercase equivalents.
Unicode
Unicode extends ASCII to cover all the world’s characters, symbols, and emoji. UTF-8 uses 1–4 bytes per character (ASCII characters use just 1 byte, maintaining backward compatibility). UTF-16 and UTF-32 use 2 or 4 bytes per character respectively.
Units of Storage
| Unit | Value |
|---|---|
| 1 bit | Single binary digit (0 or 1) |
| 1 nibble | 4 bits |
| 1 byte | 8 bits |
| 1 kilobyte (KB) | 1,024 bytes |
| 1 megabyte (MB) | 1,024 KB |
| 1 gigabyte (GB) | 1,024 MB |
| 1 terabyte (TB) | 1,024 GB |
Examiner tip: Some exam boards use 1 KB = 1,000 bytes (SI units) rather than 1,024. Check which your specification uses, though most use 1,024 for GCSE.
Calculating Image and Sound File Sizes
Image file size
File size (bits) = width (pixels) × height (pixels) × colour depth (bits per pixel)
Example: An image is 1920 × 1080 pixels with a colour depth of 24 bits.
File size = 1920 × 1080 × 24 = 49,766,400 bits = 6,220,800 bytes ≈ 5.93 MB
Sound file size
File size (bits) = sample rate (Hz) × bit depth (bits) × duration (seconds)
Example: 44,100 Hz sample rate, 16-bit depth, 3-minute recording (180 seconds).
File size = 44,100 × 16 × 180 = 126,720,000 bits ≈ 15.09 MB
Common Exam Mistakes
-
Forgetting to pad to 8 bits — when converting to binary, always fill to 8 bits: write
00101010not101010. -
Two’s complement errors — the most common mistake is forgetting to add 1 after inverting. Always do both steps.
-
Hex digit A–F — confusing B (11) and D (13) under exam pressure. Write a quick reference table at the start.
-
Overflow — students often forget to mention that overflow has occurred when the result doesn’t fit in the available bits.
-
Units — confusing bits and bytes in file size calculations. The formula uses bits — divide by 8 to get bytes.
Our revision platform includes interactive binary and hex conversion tools, flashcards for all data representation topics, and a full question bank. Or book a 1-to-1 session if you’d like these topics explained live with instant feedback.