A-level Computer Science revision · Data representation

Binary, hexadecimal and denary

The idea

Computers store data in binary (base 2). Each bit's place value doubles from the right: 1, 2, 4, 8 and so on. Hexadecimal (base 16) uses 0 to 9 and A to F, with each hex digit standing for 4 bits, so it is a compact way to write binary.

  1. Binary to denary: add the place values of the 1 bits.
  2. Binary to hex: split into groups of 4 from the right.
  3. Hex to denary: multiply each digit by its place value (1, 16, 256, ...) and add.

Watch out In hex, A to F stand for 10 to 15; there is no single digit for 16.

See it worked

Worked example

Convert 1011 0110 to denary and hex.

  1. 128 + 32 + 16 + 4 + 2 = 182.
  2. 1011 = B, 0110 = 6.
  3. Hex B6.

Answer 182, B6

Your turn

Question 12 marks

Convert the binary number 1101 0011 to denary.

Question 22 marks

Convert the hexadecimal number 3F to denary.

Question 31 mark

What is the largest denary number an 8-bit unsigned binary number can hold?

Choose one

A-level Computer Science Pro, OCR H446

A-level Computer Science Pro

£119 once

Price rises to £199 on 1 January. Save £80 by joining before then.

At least 12 months of access

By paying you agree to our Terms and get access straight away, which ends your 14-day cancellation right.

No VAT is charged.

Independent practice for OCR A-level Computer Science (H446), not endorsed by OCR.

Privacy · Terms