GCSE · Computer Science · OCR · Spec J277
Denary to hexadecimal conversion
How many 16s fit into 180? Have a go. Then work out what to do with the answer, because that count is about to turn into a letter.
Computer Science · Algorithms
Trace table — dry run the code
We're converting 180 from denary to hex. Press Start, then before each Next, guess what's coming.
Ready when you are — step through one line at a time.
Predict the next two columns
Hex place values, reading right to left, start 1, 16, and carry on.
The first two hex place values are 1 and 16. What are the next two?
Computer Science · Number representation
Check your conversions
Pick a number, but work out its hex on paper first. Then press it and compare. Ignore the row of 0 and 1 chips (that is the binary form, which this lesson doesn't need), and read the denary and hexadecimal boxes. The 0x in front of the hex answer is a common way of flagging that a number is hexadecimal; the digits after it are the answer. The small letters A to E on the number buttons are just button labels, not hex digits.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Count how many 16s fit, then turn that count into 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.
- The values 0 to 9 are straightforward. At 10 you need another character, so 10 is A, 11 is B, and so on.
Have a goJo swears the hex digit after 9 is "10". What is it really, and what comes after that?
A, then B.
A hex digit is a single character. 10 and 11 are too big to be one digit from 0 to 9, so letters step in: A for 10, B for 11.
- Hex place values go up by 16 every time, because it's base 16: 1, 16, 256 and 4,096.
- Denary to hex follows similar rules to denary to binary, but you have 16 digits to juggle, not two.
- Find the first place value that goes into your number. If 256 won't go in, drop the 256 column and any to its left.
Have a goYou're converting 40 to hex. Which of the place values 1, 16, 256 and 4,096 can you ignore?
256 and 4,096.
Neither goes into 40. Once 256 won't fit, every column to its left is too big as well, so you only use the 16s and the final column.
- Don't just put a 1 in the 16 column like binary. Work out how many 16s go in by dividing.
Have a goPriya says 50 starts with a 1 in the 16 column, "like binary". How many 16s actually go into 50, and what's left?
Three 16s (48), with 2 left over.
A hex column holds a count, not just a 1. 3 × 16 = 48, and a fourth 16 would make 64, which is too big for 50.
- That count is the digit for the 16 column. Turn it into a letter if it's 10 or more.
- The remainder is the digit for the final column. So 180 is eleven 16s with 4 left: B4.
The big picture
Hexadecimal is a base-16 number system with the digits 0 to 9 and the letters A to F. To convert a denary number, find the first place value that fits (the columns are 1, 16, 256 and 4,096), divide by 16 to find how many 16s go in, write that count as one hex digit (a letter if it's 10 or more), then write the remainder as the final digit. For example, 180 is eleven 16s with 4 left over, so it is B4.
Key points
Worked example
Problem
Convert the denary number 75 to hexadecimal.
⚠ Watch out
Treating hex like binary and dropping a 1 into the 16 column. Each hex column holds a count from 0 to 15, found by dividing by 16, and a count of 10 or more is written as a letter, not as two digits.
Memory hook
How many 16s fit? That's your first digit. What's left is your last digit. Eleven sixteens and four left over: B4.
Check yourself
Convert 90 to hex on paper: does 256 fit, how many 16s go in, what's left, and which hex digits do those become? Then press 90 in the converter to check.
Flashcards
(13)What is hexadecimal?
What do the hex letters A and B stand for?
Why does hexadecimal need letters at all?
What are the first four hex place values, right to left?
Why do hex place values go up by 16 each time?
How is denary to hex like denary to binary, and how is it harder?
Which place-value columns do you need for a hex answer?
In the 16 column, why isn't it enough to just put a 1?
What gives you the digit for the 16 column?
What gives you the final digit of the hex answer?
In a two-digit hex answer, which digit goes first?
The count of 16s comes out as 12. What goes in the 16 column?
How do you turn 180 into hex in one line?
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.