SLIDE 1
CSZone.co.uk
Click to reveal · Arrow keys also work
OCR J277 · Component 1 · Topic 1.2.4b

Hexadecimal
Conversion

Base 16 · The Nibble Table · Binary ↔ Hex · Denary ↔ Hex · Why Hex Is Used

CSZone OCR GCSE Computer Science J277
Learning Objectives

By the end of this video you will be able to...

Explain that hexadecimal is a base-16 number system using digits 0–9 and letters A–F
Use the nibble table — know that 4 binary bits = 1 hexadecimal digit
Convert an 8-bit binary number to 2-digit hexadecimal
Convert a 2-digit hexadecimal number to 8-bit binary
Convert between denary and hexadecimal (using binary as the bridge), and explain why hexadecimal is used
⚡ The OCR spec requires hexadecimal range 00–FF, matching denary 0–255 and binary 00000000–11111111
What Is Hexadecimal?

Hexadecimal is a base-16 number system

0123456789ABCDEF
0123456789 101112131415
16 hexadecimal digits, top row — and their denary values, bottom row
Denary (base 10) has 10 digits: 0–9. Binary (base 2) has 2 digits: 0–1. Hexadecimal (base 16) has 16 digits: 0–9, then A, B, C, D, E, F for the values 10 to 15.
A single hex digit can represent any value from 0 to 15 — exactly the range of a 4-bit binary number (0000 to 1111). This is the key fact behind every conversion in this video.
SPEC REQUIREMENT
The OCR spec requires hexadecimal range 00–FF — 2-digit hex, matching denary 0–255 and binary 00000000–11111111 (8 bits)
Key Tool

4 bits = 1 hex digit — memorise this table

A group of 4 bits is called a nibble. A nibble has place values 8, 4, 2, 1 — the same place value method from 1.2.4a, just with 4 columns instead of 8. Because 4 bits give 16 possible patterns (0000 to 1111), and hex has 16 digits (0 to F), every nibble maps to exactly one hex digit.
BinaryHexDenary
000000
000111
001022
001133
010044
010155
011066
011177
BinaryHexDenary
100088
100199
1010A10
1011B11
1100C12
1101D13
1110E14
1111F15
Notice: values 10–15 would normally need two denary digits, but in hex they become a single digit, A–F. That's what makes hexadecimal more compact than denary or binary for representing the same values.
⚡ This table is the key to everything in this video. Once you know it, binary ↔ hex conversion takes seconds — no addition required.
Binary → Hexadecimal

Method: split into two nibbles, convert each

STEP-BY-STEP METHOD
Step 1: Write out the 8-bit binary number
Step 2: Split it into two groups of 4 bits — the left nibble and the right nibble
Step 3: Convert each nibble to its hex digit using the nibble table
Step 4: Write the two hex digits together — left nibble's digit first
Example: Convert 10110111 to hexadecimal
Binary → Hexadecimal

Worked example: 10110111 → hex

1011
0111
Left nibble (cyan) and right nibble (purple)
1011 = 8 + 2 + 1 = 11 → B
0111 = 4 + 2 + 1 = 7 → 7
Combine: B7
10110111 in binary equals B7 in hexadecimal — write the left nibble's digit first, then the right nibble's digit, with no spaces
Hexadecimal → Binary

Method: convert each digit to a 4-bit nibble

STEP-BY-STEP METHOD
Step 1: Take each hexadecimal digit separately
Step 2: Convert each digit to its 4-bit binary equivalent using the nibble table — always write 4 bits, padding with leading zeros if needed
Step 3: Write the binary nibbles together, in the same order as the hex digits, to make an 8-bit number
Example: Convert 9E to binary
Hexadecimal → Binary

Worked example: 9E → binary

9 = 8 + 1 → 1001
E = 14 = 8 + 4 + 2 → 1110
1001
1110
10011110
Check: 10011110 = 128+16+8+4+2 = 158 in denary. And 9E = (9×16)+14 = 144+14 = 158. They match — the conversion is correct.
Denary ↔ Hexadecimal

Use binary as the bridge between denary and hex

THE EASIEST METHOD
There's no need to learn a separate denary↔hex method. Convert denary → 8-bit binary (1.2.4a method), then binary → hex (this video's method). To go the other way, convert hex → binary, then binary → denary.
Denary 49 → binary 00110001 → split into nibbles 0011 | 0001 → hex 31
Denary 244 → binary 11110100 → split into nibbles 1111 | 0100 → hex F4
Going the other way works the same: hex 31 → binary 00110001 (3=0011, 1=0001) → denary 32+16+1 = 49.
The OCR 2023 mark scheme table extends the same denary/binary conversions from 1.2.4a with a hexadecimal column — so the same numbers come up again: 7 → 07, 49 → 31, 102 → 66, 244 → F4.
Why Hexadecimal?

Why is hexadecimal used instead of binary?

SHORTHAND FOR BINARY
Hex uses far fewer characters to represent the same value as binary. 100111101011 in binary is just 9EB in hexadecimal — 12 characters become 3. Shorter numbers are quicker to read, write, and type, and far less likely to contain errors.
MAC addresses — the unique address built into network hardware is written in hexadecimal, e.g. 00:1A:2B:3C:4D:5E
Defining colours — HTML and CSS colours are written as hex codes, e.g. #FF0000 for red, where each pair of hex digits sets the red, green, and blue values
Memory addresses and error codes — locations in memory and debugging error codes are commonly displayed in hexadecimal because long binary addresses would be unreadable
Exam phrasing to remember: hexadecimal is used because it is shorter / more compact than binary, easier for humans to read and write, and less error-prone when transcribing long binary numbers.
Exam Practice

Exam Question 1 — Binary to Hex

Question 1 · 4 marks
Convert each of the following 8-bit binary numbers to hexadecimal.
4 marks — 1 per row
Binary Hexadecimal
11110101 F5
01100111 67
10111010 BA
10010000 90
MS NOTE
Split each byte into two nibbles and convert each nibble using the table — no addition needed.
Exam Practice

Exam Question 2 — Hex to Binary

Question 2 · 4 marks
Convert each of the following hexadecimal numbers to 8-bit binary.
4 marks — 1 per row
Hexadecimal 8-bit binary
C2 11000010
8A 10001010
DE 11011110
54 01010100
MS NOTE
Each hex digit must become exactly 4 bits — pad with leading zeros within the nibble where needed (e.g. hex 5 → 0101, not 101).
Exam Practice

Exam Question 3 — Denary to Hex + Explain

Question 3 · 3 marks
a) Convert denary 200 to hexadecimal. Show your working.    b) Give one reason why a programmer might choose to display a memory address in hexadecimal rather than binary.
3 marks
Step 1 — denary 200 → binary (from 1.2.4a): 11001000
1100
1000
1100 = 12 = C   |   1000 = 8 = 8
200 = C8
PART b — ANSWER
Hexadecimal is shorter / more compact than binary, easier for a human to read and write, and less likely to contain transcription errors.
M1/M2
Working shown + correct hex answer C8
M3
Any one valid reason for using hex (shorter, easier to read/write, fewer errors)
Common Mistakes

Four mistakes that cost marks in the exam

1
Forgetting to pad each nibble to 4 bits. When converting hex to binary, each digit must become exactly 4 bits. Hex 5 is 0101, not 101. Dropping the leading zero within a nibble gives a 7-bit answer and loses the mark.
2
Splitting binary into the wrong groups. Always split an 8-bit binary number into two groups of exactly 4 — left nibble and right nibble. Splitting into groups of 2 or 3, or splitting from the wrong end, gives the wrong hex digits entirely.
3
Mixing up letters and numbers. Remember A=10, B=11, C=12, D=13, E=14, F=15. A common error is writing "10" instead of "A", or confusing B (11) with 8 or 13. Learn the nibble table so this becomes automatic.
4
Trying to convert denary to hex directly without binary. There is a direct method using powers of 16, but it's easy to make errors under exam pressure. Going via binary — denary → binary → hex — reuses the methods you already know from 1.2.4a and is far more reliable.
Summary

1.2.4b — Hexadecimal Conversion

BASE 16
Digits 0–9, then A–F for 10–15. Range: 00 (0) to FF (255)
THE NIBBLE TABLE
4 bits = 1 hex digit. Place values 8, 4, 2, 1. 1010 = A, 1111 = F
BINARY → HEX
Split into 2 nibbles, convert each
10110111 = B7
HEX → BINARY
Convert each digit to a 4-bit nibble, combine
9E = 10011110
DENARY ↔ HEX & WHY HEX
Use binary as the bridge. Hex is used because it's shorter, easier to read/write, and less error-prone — e.g. MAC addresses, colour codes, memory addresses
CSZone.co.uk

That's 1.2.4b done.

Next up: 1.2.4c — Binary Arithmetic and Overflow

Full quiz, instantly marked worksheet and slides at CSZone.co.uk