GCSE · Computer Science · OCR · Spec J277
Binary to hexadecimal conversion
Hex looks like a secret code: A7, 3C, D6. The secret is that each character is just four binary digits in disguise.
Computer Science · Data representation
Flip four bits, watch the hex digit
Tap the bits to make any pattern from 0000 to 1111. The decimal value and the hex digit follow along. The 0x in front of the hex digit is just a flag saying 'this is hexadecimal'.
Computer Science · Number representation
Now go the other way: hex to binary
To turn hex into binary, take each hex digit on its own, find its decimal value, then write that value as 4 bits using the place values 8, 4, 2 and 1. Pick Hex A7 and compare each nibble with its digit.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Chop binary into groups of four bits and each group becomes exactly one hex digit.
What you need to know
- Hexadecimal is a base-16 number system. It uses the digits 0 to 9 and the letters A, B, C, D, E and F.
- Up to 9, hex looks like everyday numbers. At 10 another character is needed: 10 is A, 11 is B, and so on.
- Four binary digits correspond to one hexadecimal digit.
- A group of 4 binary digits is called a nibble.
Have a goSam says both 1101 and 11010 are nibbles, and is very confident about it. One of those is not. Which one?
11010
A nibble is a group of exactly 4 binary digits. 11010 has five, so it cannot be a nibble.
- Binary to hex: split the number into 4-bit nibbles, working from the right (the least significant bit).
- Find each nibble's decimal value by adding the place values 8, 4, 2 and 1 that sit under a one.
Have a goFind the decimal value of the nibble 1001. Which place values count?
8 + 1 = 9
Only the place values over a one count. The 4 and the 2 sit over zeros, so they are left out.
- Turn each nibble's value into its hex digit, then join the digits in order.
- Hex to binary: take each hex digit on its own and find its decimal value.
- Write each value as a 4-bit binary number using the place values, then join the nibbles.
Have a goWrite the hex digit 5 as a 4-bit binary number. Which place values do you switch on?
0101 (the 4 and the 1)
4 + 1 = 5, so the 4 and the 1 are on. The leading 0 keeps it at 4 bits.
The big picture
Hexadecimal is a base-16 number system that uses the digits 0 to 9 and the letters A to F. Four binary digits match one hex digit, so you convert by splitting binary into nibbles from the right, turning each nibble into a hex digit and joining them. To go back, turn each hex digit into four bits.
Key points
Worked example
Problem
Convert the hexadecimal number B2 to binary.
⚠ Watch out
Writing the values ten, eleven and so on as two-character numbers in hex. Every hex digit is a single character, so ten is A, eleven is B and fifteen is F.
Memory hook
One hex digit, one nibble: four bits in, one character out.
Check yourself
Without looking back, say why four bits make exactly one hex digit. Then convert 10010011 to hexadecimal, nibble by nibble.
Flashcards
(10)What is hexadecimal?
Which hex character stands for the value ten?
What are the hex digits for the values 11 and 15?
How many binary digits correspond to one hexadecimal digit?
What is a group of 4 binary digits called?
Why split a binary number into nibbles before converting to hex?
Binary to hex: where do you start splitting into nibbles?
How do you find the decimal value of a nibble?
You have the decimal value of a nibble. What next?
Hex to binary: how many bits does each hex digit become?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore OCR GCSE Computer Science topics
How this lesson was checked. This OCR GCSE Computer Science (specification J277)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 14 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.