GCSE · Computer Science · AQA · Spec 8525

Convert binary ↔ hexadecimal

Binary to hex needs no big sum, just a pencil line down the middle. By the end of this page, 1101 0110 → D6 will take you five seconds.

Computer Science · Binary and hex

Flip a bit. Which hex digit moves?

8-bit binary 00110101 = 53 in denary, 0x35 in hex

Decimal53Hex0x35
Try making the right-hand four bits 1010. What appears in the Hex readout?

Start with the right-hand four bits: flip any of them and watch the Hex readout. Notice something? Now try the left-hand four. Last of all, switch all eight bits on and see how far one byte goes.

Watch out: The 0x in front of the hex readout is a label that program code uses to say a number is in hex. It isn't part of the number: the starting byte, 0011 0101, is written 35 in hex, not 0x35.

Watch it done: binary to hex

Problem

Convert the byte 1011 1001 into hexadecimal.

Your turn

Now go backwards: hex to binary

Convert the hex number E3 into an 8-bit binary number.

  1. Work one hex digit at a time: E first, then 3.
  2. missing step
Which line is step 2?

Find the faulty line

Which line loses the mark?

Convert the byte 1100 0111 into hexadecimal.

A student's answer — which line goes wrong?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Why a byte splits neatly in half, and how that turns binary into hex and back without a single long sum.

What you need to know

  • Four bits make a nibble. A byte is eight bits, so every byte splits neatly into two nibbles.
  • Four bits give 16 patterns, 0000 to 1111, and hex has 16 digits. That's why one nibble is exactly one hex digit.
  • After 9, hex keeps counting with letters: A is 10, B is 11, and so on up to F, which is 15.
  • Have a goYour mate reckons the hex digit for 12 must be L, because L is the 12th letter of the alphabet. Are they right?

    No. 12 is C.

    Hex letters don't start counting from the beginning of the alphabet. They carry on after 9, so A is 10, B is 11 and C is 12.

  • Inside each nibble the place values run 8, 4, 2, 1 from the left. The left nibble gets its own 8-4-2-1 too.
  • Going from binary to hex? Chop the byte down the middle, count each half, then write each value as one hex digit.
  • Have a goHave a go before you peek: what is 0100 1110 in hex?

    4E

    0100 is 4, and 1110 is 8 + 4 + 2 = 14, which is the single digit E. Writing 414 would squeeze two characters into one nibble.

  • Going the other way, every hex digit becomes its own four bits, joined in the same order as the digits.
  • Keep the zeros on the left of a nibble: 3 is 0011, not 11. Drop them and the other bits slide out of place.
  • Have a goTurn the hex number 1F into an 8-bit binary number.

    0001 1111

    1 is 0001 with its three zeros kept, and F is 15 = 8 + 4 + 2 + 1 = 1111. Writing 1 1111 leaves only five bits.

  • No decimal detour needed. Each nibble converts on its own, so you never have to work out the whole number.
  • The biggest byte is 1111 1111. In hex that's FF; in decimal it's 255.

The big picture

One hex digit stands for exactly four bits, a group called a nibble, because four bits have 16 patterns and hex has 16 digits: 0 to 9, then A to F. Binary to hex: split the byte into two nibbles, find each one's value with 8, 4, 2, 1, and write each value as one hex digit, so 10 to 15 become A to F. Hex to binary: turn each digit into its own four bits, keeping zeros on the left. One byte runs from 0000 0000 up to 1111 1111, which is FF in hex and 255 in decimal.

Key points

1A nibble is a group of four bits. A byte is eight bits, so it splits into two nibbles.
2Four bits have 16 possible patterns, 0000 to 1111, and hex has 16 digits, 0 to 9 then A to F. So each nibble matches exactly one hex digit.
3The hex digits A to F stand for the values 10 to 15: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
4Binary to hex: split the byte into two nibbles, find each nibble's value using the place values 8, 4, 2, 1, then write each value as a single hex digit.
5Hex to binary: write each hex digit as its own four bits, then join them in the same order. Always write all four bits, so 3 is 0011, not 11.
6You never need the whole number in decimal to convert between binary and hex. Each nibble is converted on its own.
7The largest value one byte can hold is 1111 1111 in binary, which is FF in hex and 255 in decimal.

Worked example

Problem

A game stores a character's energy in one byte and shows it on screen in hex. (a) The screen shows 5D. Write the byte in binary. (b) After a power-up, the byte is 1010 0101. What does the screen show now?

⚠ Watch out

Writing a nibble's value as an ordinary number instead of one hex digit, so 1110 1000 becomes 148 instead of E8. Looks reasonable. It isn't: the left nibble is worth 14, and 14 is the single hex digit E. Each nibble gives exactly one character.

🧠

Memory hook

Chop, count, letter. Chop the byte in half, count each half with 8-4-2-1, and turn 10 to 15 into A to F. Going back? Every digit gets four bits, zeros and all.

✓

Check yourself

Without finding the decimal value, write 0110 1101 in hex, and write 9A as 8-bit binary. Then convert each answer back: if you get what you started with, you're right.

Flashcards

(8)
What is a nibble?
A group of four bits. A byte is two nibbles.
Why does one hex digit match exactly four bits?
Four bits have 16 patterns (0000 to 1111) and hex has 16 digits (0 to F), so each pattern has exactly one digit.
What values do the hex digits A to F stand for?
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
What are the place values inside one nibble, from left to right?
8, 4, 2, 1. Each nibble gets its own set, even the left-hand one.
Binary to hex: what are the three moves?
Split the byte into two nibbles, find each nibble's value with 8-4-2-1, then write each value as one hex digit.
Hex to binary: what are the moves?
Write each hex digit as four bits, keeping zeros on the left, then join the nibbles in the same order as the digits.
What is the largest value one byte can hold?
1111 1111 in binary, FF in hex, 255 in decimal.
In a two-digit hex number, what does the left digit count?
Sixteens. The left nibble's place values, 128, 64, 32 and 16, are 8, 4, 2 and 1 lots of 16. The right digit counts ones.

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 posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)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 28 October 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.