Hexadecimal Numbers (OCR A Level Computer Science)

Revision Note

James Woodhouse

Expertise

Computer Science

Representing Hexadecimal Numbers

What is Hexadecimal?

  • It serves as a more human-friendly representation of binary-coded values

  • Another numbering system is hexadecimal (base-16)

  • It consists of 10 numbers (0-9) and 6 letters (A-F)

Why use hexadecimal instead of binary?

  • It is more concise as four binary bits (e.g. 1010) can be represented with one hexadecimal character (e.g. A)

  • It is easier for humans to read and write

  • it is less prone to error as it is more likely to be communicated correctly

Potential uses of hexadecimal

  • It is commonly used for debugging, configuring hardware devices, and in cryptographic algorithms

  • It also also commonly used to define colours. As there are millions of colours in the visual spectrum that require very large binary numbers to represent them, they can be replaced with shorter hexadecimal values

hexcolours

Sample hexcolours 

Hexadecimal Lookup Table

  • The hexadecimal lookup table serves as a quick reference for converting numbers between denary, binary and hexadecimal values

  • The hexadecimal scale is identical to the denary scale until the tens column is introduced

  • When the denary scale reaches 10, this is when the hexadecimal scale switches to letters, starting with A

Denary

Binary

Hexadecimal

0

0000

0

1

0001

1

2

0010

2

3

0011

3

4

0100

4

5

0101

5

6

0110

6

7

0111

7

8

1000

8

9

1001

9

10

1010

A

11

1011

B

12

1100

C

13

1101

D

14

1110

E

15

1111

F

Using subscript in number representation

  • The subscript in number representation denotes the base of a number

  • It helps in differentiating between number systems

  • Common uses:

    • 1 0 subscript 2 indicates the number is in binary (base 2), and its value is '10' in binary

    • 1 0 subscript 10​ indicates the number is in denary (base 10), and its value is '10' in denary

    • 1 0 subscript 16​ indicates the number is in hexadecimal (base 16), and its value is '10' in hex, equivalent to '16' in denary

  • It provides clarity, especially in contexts where multiple numbering systems are discussed

Denary to Hexadecimal

Convert the denary number 241 to hexadecimal.

Step 1: Convert the number to binary

number to binary

Step 2: Split the binary number into nibbles

binary number to nibbles

Step 3: Convert each nibble into its hexadecimal value

nibbles to hexadecimal values

Step 4: Final result

The denary number 241 is F1 in hexadecimal. 

Hexadecimal to Denary

Convert the hexadecimal value 1A to denary. 

Step 1: Convert each hexadecimal character into binary

hexadecimal character to binary

Step 2: Join the binary values

binary values

Step 3: Final result

16 + 8 + 2 = 26

The hexadecimal value 1A is 26 in denary. 

Binary to Hexadecimal

Convert 1101 0101 to hexadecimal.

Step 1: Take the binary values

Binary values

Step 2: Convert each nibble into its hexadecimal value

nibble to hexadecimal

Step 3: Final result

The binary number 11010101 is D5 in hexadecimal.

Hexadecimal to Binary

Convert B2 from Hexadecimal to Binary.

Step 1: Split the Hexadecimal into two separate digits and convert each to a nibble

hexadecimal to nibble

Step 2: Join the two nibbles to make a byte (8 bits)

nibbles

Step 3: Final result

The hexadecimal number B2 in Binary is 10110010

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

James Woodhouse

Author: James Woodhouse

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.