GGCSE Revision Hub

3.3.2 Converting between number bases

AQA Computer Science 8525Topic 3.3 — Fundamentals of data representationFoundation & Higher

Everything a computer stores is a pattern of ones and zeros. This topic is about how the same binary building blocks are arranged to hold numbers, text, pictures, sound and compressed data, and how you work backwards from what is stored to what it means. It is the most calculation-heavy part of Paper 2, and the calculations are all variations on the same two ideas: count the bits, and read the pattern.

What you need to know

What you must be able to do

Understand how binary can be used to represent whole numbers, and be able to represent decimal values between 0 and 255 in binary. The same for hexadecimal. Be able to convert in both directions between binary and decimal, binary and hexadecimal, and decimal and hexadecimal. The maximum values used are decimal 255, binary 1111 1111 and hexadecimal FF — which is the same number written three ways.

Key fact: Convert both ways between binary, decimal and hex, for values up to 255 (1111 1111 / FF).

Decimal to binary

Repeatedly divide by 2 and read the remainders upwards. For 100: 100 ÷ 2 = 50 remainder 0; 50 ÷ 2 = 25 remainder 0; 25 ÷ 2 = 12 remainder 1; 12 ÷ 2 = 6 remainder 0; 6 ÷ 2 = 3 remainder 0; 3 ÷ 2 = 1 remainder 1; 1 ÷ 2 = 0 remainder 1. Reading the remainders from the bottom up gives 1100100, which padded to 8 bits is 0110 0100.

Key fact: Decimal to binary: divide by 2 repeatedly and read the remainders from the bottom up.

Binary to decimal

Multiply each 1 bit by its place value and add them up. 0110 0100 is 0×128 + 1×64 + 1×32 + 0×16 + 0×8 + 1×4 + 0×2 + 0×1 = 64 + 32 + 4 = 100. The place values from the right are 1, 2, 4, 8, 16, 32, 64, 128.

Key fact: Binary to decimal: multiply each 1 by its place value and add.

Binary to hexadecimal

This is the easiest conversion of all. Split the binary into groups of four from the right, and convert each group into one hex digit: 1100 1010 becomes C A. If there is a group of fewer than four bits at the front, pad it with zeros first: 1010 becomes 0000 1010, which is 0 A.

Key fact: Binary to hex: group into fours from the right, padding the front group with zeros.

Hexadecimal to binary and decimal

Hex to binary is the same process in reverse: each hex digit becomes exactly four binary digits, so F becomes 1111 and A becomes 1010. Hex to decimal is done by multiplying each digit by its place value, where the places are 1, 16, 256, 4096 and so on: 2A is 2×16 + 10 = 42.

Key fact: Hex to binary: 4 bits per digit. Hex to decimal: place values of 16, 256, 4096.

Decimal to hexadecimal

Repeatedly divide by 16 and read the remainders upwards, exactly as for binary but with 16 instead of 2. Any remainder above 9 is written as a letter: A for 10 up to F for 15. For 200: 200 ÷ 16 = 12 remainder 8, 12 ÷ 16 = 0 remainder 12, so the answer is C8.

Key fact: Decimal to hex: divide by 16 repeatedly, using A to F for remainders 10 to 15.

Flashcards

Exam questions

Written in the style of AQA Computer Science, with a mark scheme for each one. No question here is a real past paper question.

mcq1 mark

What is the hexadecimal equivalent of the binary number 1100 1010?

  • 12A
  • CA
  • AA
  • C0

Mark scheme: 1 mark for choosing CA, since 1100 is C and 1010 is A when each group of four bits is converted to one hex digit.

calc2 marks

Convert the decimal number 100 into binary and then into hexadecimal.

Answer: 100 in binary is 0110 0100; 100 in hexadecimal is 64.

six6 marks

Explain in English how to convert between decimal, binary and hexadecimal, and why hexadecimal is the easiest of the three to work with.

Mark scheme: Level 1 (1-2 marks): A short answer saying decimal to binary uses repeated division by 2 and binary to hex uses groups of four. Level 2 (3-4 marks): A structured answer describing each conversion with an example. Level 3 (5-6 marks): A detailed answer describing repeated division by 2 with the remainders read upwards, repeated division by 16 for hex with A to F for remainders of 10 to 15, multiplication by place values to go back to decimal, and grouping into fours for binary to hex, explaining that hex is easiest because one digit is exactly four bits so the conversion is a lookup rather than arithmetic, and noting the equivalent maximum values of 255, 1111 1111 and FF.

Other sections in this topic

Practise these questions

Answer them in the interactive view and they get marked against the same mark scheme, one mark at a time, with the reason for each mark.

Open the interactive topic →