Data Representation
Hexadecimal uses, binary addition and overflow
In this note
- 1.1.3Explain how and why hexadecimal is used as a beneficial way to represent data, and name where it is used.
- 1.1.4Add two positive 8-bit binary integers, showing the carries.
- 1.1.4Explain overflow and why it happens in binary addition.
Before this: Number systems (conversions). Next: Logical shifts and two's complement.
The notes: every idea from the start, with our own examples.
What you should already know
Binary ↔ hex
One hex digit is exactly four bits: group binary in fours from the right.
Quick check: what is 1101 0010 in hex?
D2.
Adding in columns
In denary, 7 + 5 = 12: write 2 and carry 1 into the next column. Binary works the same way, but you carry as soon as a column reaches 2.
Quick check: in denary, what is carried in 8 + 6?
1 (8 + 6 = 14: write 4, carry 1).
Why hexadecimal is used
A computer never processes hexadecimal: inside, everything stays binary. Hex is used by people (programmers, technicians) as a short way of writing binary. Compare the same 16-bit value:
| Binary | Hexadecimal |
|---|---|
| 1010 0000 0011 1101 | A03D |
The hex is four characters instead of sixteen. That is the whole idea, and the benefits all come from it:
Shorter
A shorter representation of binary: one hex digit replaces four bits, so it takes up less space on screen or paper.
Easier for humans
Easier and quicker to read, write, understand and remember than a long string of 1s and 0s.
Fewer mistakes
Less likely to make a mistake copying or typing it, and easier to spot errors / debug.
Converts easily
Each hex digit is exactly 4 bits, so it converts straight to and from binary (no big sums, unlike denary).
Where hexadecimal is used
| Use | What it looks like | What it is |
|---|---|---|
| HTML colour codes | #FF8000 | a colour on a web page: two hex digits each for the amount of red, green and blue (00 to FF = 0 to 255) |
| MAC addresses | 00:1A:2B:3C:4D:5E | the unique address of a network interface card (12 hex digits = 48 bits) |
| IPv6 addresses | 2001:0DB8:85A3::8A2E:0370:7334 | the address of a device on the internet (128 bits, written in groups of 4 hex digits) |
| Memory addresses and memory dumps | A2F, 0x7FF3A2 | locations in memory shown to a programmer when debugging |
| Error codes | 0x80070057 | codes shown when a program or device fails, so a technician can look them up |
| Assembly language / machine code | LDA &3F | instructions and values written in hex by low-level programmers |
| URLs | %20 for a space | characters that can't appear in a web address are written as hex codes |
| Character codes | ASCII 41 = 'A' | the ASCII / Unicode value of a character |
Try it yourself
Show working
- FF = 15 × 16 + 15 = 255
Answer 255
Show working
- 12 × 4 = 48
Answer 48
Adding two binary numbers
Binary addition works column by column from the right, exactly like denary, except that there are only two digits. There are only four sums to know:
| Column adds up to | Write | Carry to the next column |
|---|---|---|
| 0 + 0 = 0 | 0 | 0 |
| 0 + 1 = 1 | 1 | 0 |
| 1 + 1 = 2 (binary 10) | 0 | 1 |
| 1 + 1 + 1 = 3 (binary 11), with a carry | 1 | 1 |
General methodAdding two 8-bit binary numbers
- Write the two numbers one under the other, lined up on the right. Leave a row above for the carries.
- Start at the rightmost column. Add the two bits and any carry.
- Write the result bit (0 or 1) underneath; write any carry above the next column to the left.
- Repeat for every column, moving left.
- If there is still a carry out of the leftmost (8th) column, it needs a 9th bit: that is overflow.
- Check: convert both numbers and the answer to denary; the sums must match.
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |||
|---|---|---|---|---|---|---|---|---|---|---|
| Carry | 1 | 1 | 1 | 1 | 1 | 1 | ||||
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | |||
| + | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | ||
| Answer | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |
Try it yourself
Show working
- 51 + 120 = 171 = 1010 1011
Answer 1010 1011
Show working
- 155 + 19 = 174 = 1010 1110
Answer 1010 1110
Overflow
A register has a fixed number of bits. An 8-bit register can hold 0 to 255; a 16-bit register 0 to 65 535. Every computer and device has a predefined limit like this.
If the answer to a sum is too large to fit in the number of bits available, it would need an extra bit that the register does not have. This is an overflow error. The extra bit is lost and the value left in the register is wrong.
| OF | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
|---|---|---|---|---|---|---|---|---|---|---|
| Carry | 1 | 1 | ||||||||
| 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | |||
| + | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 1 | ||
| Answer | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
Try it yourself
Show working
- 195 + 80 = 275
- 275 needs 9 bits: 1 0001 0011
Answer 1 0001 0011: yes, overflow (195 + 80 = 275 > 255)
Show answer
Answer 65 535
Summary
- Hex is for humans: a shorter representation of binary, easier to read, write, remember and debug, fewer mistakes, less screen space. It converts easily because one hex digit = 4 bits.
- Uses of hex: HTML colour codes, MAC addresses, IPv6 addresses, memory addresses / dumps, error codes, assembly language, URLs, character codes.
- Binary addition: 1 + 1 = 0 carry 1; 1 + 1 + 1 = 1 carry 1. Work right to left and show every carry.
- Overflow: the result is too large for the number of bits in the register (over 255 for 8 bits), so an extra bit would be needed and the stored value is wrong.
If you see …
- "Give a reason hexadecimal is used"a benefit FOR HUMANS: shorter / easier to read / fewer mistakes
- "Show all your working" in an additionwrite the carry row
- a carry out of the 8th columnshow the 9th bit and say overflow
Question types, what the examiner gives marks for, and real past-paper questions solved.
Ways they test it
Type 1 Benefit of hex
"Give one reason why the addresses are displayed in hexadecimal instead of binary" [1-2]
Spot it "instead of binary", "benefit", "reason a programmer may use hexadecimal".
- Pick one benefit per mark: shorter / easier to read / fewer mistakes / easier to debug / less screen space.
- Write it as a comparison: "it is shorter than binary".
Type 2 Uses of hex
"Identify two other ways hexadecimal is used in computer science" [2]
Spot it "identify", "other ways".
- Name two uses from the table, not the one already in the question.
- A name is enough for "identify".
Type 3 Binary addition
"Add the two 8-bit binary numbers using binary addition. Show all of your working" [3-4]
Spot it two 8-bit numbers one above the other.
- Carry row, then the answer.
- Marks: one per correct nibble, one for the carries, one more for showing the overflow bit when there is one.
Type 4 Explain overflow
"Explain why the overflow error occurred" [2]
Spot it "overflow".
- The result is greater than 255 / too large for the register.
- It needs more than 8 bits / the register has a fixed number of bits.
Type 5 Definition (multiple choice)
"Tick one box to show the correct definition of overflow" [1]
Spot it four statements.
- Choose "too large to represent in the number of bits available"; not "too small", not "negative".
What the examiner looks for
"Give two reasons why a programmer may use hexadecimal to represent binary" [2]
Marking points (one mark each, up to the marks shown)
- Easier / quicker to understand, read or write
- Easier / quicker to debug
- Less likely to make a mistake
- Shorter representation // takes up less screen space
Keywords shorter easier to read fewer errors debug
Too vague "takes less memory"; "the computer processes it faster"
"Explain why the overflow error occurred" [2]
Marking points (one mark each, up to the marks shown)
- The result of the calculation is greater than 255 // the value is larger than can be stored in the register
- The result would need more than 8 bits // a register has a predetermined number of bits and there are too many bits for it
Keywords greater than 255 more than 8 bits fixed number of bits
Too vague "the number is too big" with no mention of the bits or 255
A reason for using hexadecimal
- It is easier / quicker to read, understand or debug
- It is a shorter representation of binary // takes up less screen space
- It uses less storage / memory
- The computer can process it faster
The computer stores binary whatever you display. Hex only helps the person reading it.
From: 0478/13/M/J/24 Q3(c) mark scheme
Past-paper questions, solved

How to start Hex to binary is four bits per digit (keep the 0010). For binary to hex group in fours from the right. Parts (c) and (d) are recall.
Show a full-mark answer and the mark scheme
(a)(i) A = 1010, 2 = 0010, F = 1111 → 1010 0010 1111 (ii) 10 × 256 + 2 × 16 + 15 = 2607
(b)(i) 0001 | 1001 | 1011 → 19B (ii) 256 + 128 + 16 + 8 + 2 + 1 = 411
(c) It is shorter than binary, so it is easier to read and debug.
(d) HTML colour codes; MAC addresses.
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| 3(a)(i) | 1010 0010 1111 | B3 | one mark for each correct nibble, in the correct order |
| 3(a)(ii) | 2607 | B1 | |
| 3(b)(i) | 1 · 9 · B | B3 | one mark for each correct character, in order |
| 3(b)(ii) | 411 | B1 | |
| 3(c) | Any one: easier / quicker to read / understand / debug · shorter representation of binary // less screen space | B1 | |
| 3(d) | Any two: HTML colour codes · URL · memory dump · IP address · MAC address · assembly language · error codes · ASCII / Unicode | B2 | |
| Total: 11 marks | |||

How to start Set out the carry row first. For (f), give two separate facts: the size of the result and the size of the register.
Show a full-mark answer and the mark scheme
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |||
|---|---|---|---|---|---|---|---|---|---|---|
| Carry | 1 | 1 | ||||||||
| 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | |||
| + | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | ||
| Answer | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 1 |
(e) 1101 0101 (101 + 112 = 213, so no overflow here).
(f) The result is greater than 255, so it is too large for the register. It would need more than 8 bits, but the register only has 8.
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| 1(e) | 1101 0101 | B2 | one mark for each correct nibble |
| 1(e) | correct method of working, e.g. showing carries | M1 | |
| 1(f) | Any two: the result is greater than 255 // too large · cannot be stored in 8 bits // in the bits available for the register | B2 | |
| Total: 5 marks | |||

How to start Two big numbers (both start with 11): expect a carry out of the last column. Show it as a 9th bit.
Show a full-mark answer and the mark scheme
| OF | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
|---|---|---|---|---|---|---|---|---|---|---|
| Carry | 1 | 1 | ||||||||
| 1 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | |||
| + | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | ||
| Answer | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |
1 1010 1111: the 9th bit is an overflow (227 + 204 = 431, more than 255).
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| 1(d) | 1010 1111 | B2 | one mark for each correct nibble |
| 1(d) | method of working, e.g. carries | M1 | |
| 1(d) | identification of overflow (the extra 1) | B1 | |
| Total: 4 marks | |||
Examiner tip The overflow bit earns its own mark: write it, and label it.
Common mistakes
- ✗ "Hex takes up less memory"✓ "Hex is shorter / easier for humans to read"The computer stores binary either way.
- ✗ Leaving out the carries✓ A carry row above the sumThe working mark is for the carries.
- ✗ Dropping the 9th bit silently✓ Write the extra 1 and label it overflowThere is a mark for identifying the overflow.
- ✗ "Overflow is when the number is too small / negative"✓ "Too large for the number of bits available"
Practice
Practice: easy, medium, hard
Easy
Show working
- 21 + 38 = 59
Answer 0011 1011
Show answer
Answer e.g. HTML colour codes / MAC addresses / error codes
Show answer
Answer 255
Medium
Show working
- 118 + 48 = 166
Answer 1010 0110
Show answer
Answer Shorter / takes less screen space; easier to read and remember; fewer mistakes when copying
Show working
- 80 = 8 × 16 = 128
Answer 128
Hard
Show working
- 189 + 102 = 291
- 9 bits needed
Answer 1 0010 0011: overflow, because 189 + 102 = 291 > 255 and the 9th bit is lost
| Part | Answer / working | Marks | Guidance |
|---|---|---|---|
| 1 0010 0011 (each nibble) | B2 | ||
| carries shown | M1 | ||
| overflow identified | B1 | ||
| Total: 4 marks | |||
Show working
- 0 = 0000, F = 1111, C = 1100, 8 = 1000
- 15 × 256 + 12 × 16 + 8 = 3840 + 192 + 8 = 4040
Answer 0000 1111 1100 1000 · 4040
Can I do this?
- I can give benefits of hexadecimal, all of them for humans.
- I can name at least four uses of hexadecimal.
- I can add two 8-bit binary numbers with a carry row.
- I can explain overflow in two marking points and show the overflow bit.
Anything unticked: revise that section first. All ticked: take the quiz.
Quiz
The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.
Your progress on this note is saved when JavaScript is on.
⬇️ Download this chapter as a PDF: Full notes