You are on page 1of 15

Computer Science

Unit 1 - 1.2 Data Representation - Hexadecimal


Today’s Lesson
Learning Outcomes:
● Know what hexadecimal is
● Understand why we use hexadecimal
● Understand hexadecimal to denary conversion
● Understand denary to hexadecimal conversion
Denary Hex Denary Hex

Hexadecimal 0 0 10 A

1 1 11 B
● Hexadecimal (hex) is a
2 2 12 C
number system that uses
3 3 13 D
16 digits
4 4 14 E
● Also referred to as Base
6 6 15 F
16
7 7
● Uses 16 different digits 8 8
from 0 - F 9 9
Place values in hexadecimal
In denary, each column is 10 times bigger than the column on its right.
10000000 1000000 100000 10000 1000 100 10 1

In binary, each column is 2 times bigger than the column on its right.
128 64 32 16 8 4 2 1

In hexadecimal, each column is 16 times bigger than the column on its right. (Don’t
worry, you do not need to remember these large numbers!)

268435456 16777216 1048576 65536 4096 256 16 1


Let’s look at an example of a Denary Hex Denary Hex
hexadecimal number: 0 0 10 A

What does this mean? 1 1 11 B

Let’s add the place values 2 2 12 C

3 3 13 D

4 4 14 E
16 1 16 1
6 6 27
15 F

1B
7 7

1 11 8 8

9 9
Why use hexadecimal? Video

● Hexadecimal was designed to benefit humans. Computers do not understand


hex….they only understand binary.
● It is hard for people to read and understand long binary numbers - 10111101010001101
in Binary is 17A8D in Hex - Far fewer characters so less likely to make mistakes.
● Writing binary numbers takes up a lot of space (physically).
● It is easy to make a mistake writing long binary numbers - Try copying the following
binary number - 01101011111111110110100111111011 - In Hex, it’s 6BFF69FB (much easier!)
● It is easy to convert binary into hexadecimal.
● It is easy to convert hexadecimal into binary.
● Hexadecimal is much easier to read than binary.
Try these on your own: Convert the following numbers from
hexadecimal to denary. Write down the place values to help you…….

1. 3A 16 1 1. 58
2. 55 2. 85
3. AA 3. 170
4. 2F 4. 47
5. 4D 5. 77
6. 37 6. 55
7. 19 7. 25
8. F4 8. 244
9. 5A 9. 90
10. F9 10. 249
Converting larger hexadecimal numbers
We have looked at examples of hexadecimal numbers with one
or two digits, for example 4A or 13.

How does it work with 3 or more digits? Well, it’s the same as
any other base, you just add the next place value.

256 16 1

13B 1 3 B 315
Converting Denary to Hexadecimal
● In a similar way to binary, turn on the ‘switches’ that you need to make your number.
● Remember, you can use more than one of each place value by using the appropriate
hex character.
● For example, to make 182 we need 11 (B) lots of 16 and 6 lots of 1. - B6

268435456 16777216 1048576 65536 4096 256 16 1

● Try to convert the following denary numbers to hexadecimal

● 9 ● 9 Did you find


● 21 ● 15 this hard?
● 59 ● 3B Don’t worry,
● 87 ● 57 there is an
easier way!
● 167 ● A7
Converting Denary to Hex the easy (but longer) way!
● Convert the denary number to binary.

● Split the binary number into nibbles (four bits).

3 10 Remember,
in hex, we

58 00111010 3A can’t write


10! We
have to
58 write A!

● Convert each nibble to hex.


Converting Hex to Binary

● If you are happy with long multiplication, feel free to


multiply each hex digit by its place value.
● If you do not like long multiplication, do the long method in
reverse.

3 A

3A 0011 1010 58
Join the two nibbles together and convert the full binary number to denary.
Convert the following hex numbers to binary and to
denary

● 15 ● 0010101 ● 21
● 3C ● 00111100 ● 60
● 8A ● 10001010 ● 138
● 1A2 ● 000110100010 ● 418
● 14F ● 000101001111 ● 335
● 22D ● 001000101101 ● 557
● DD ● 11011101 ● 221
● 19 ● 00011001 ● 25
● FF ● 11111111 ● 255
Take a look at these
past paper questions.
Would you feel
comfortable
answering them?

Take your time and


read the questions
carefully.

These questions are


easy marks to get!
Take a look at these
past paper questions.
Would you feel
comfortable
answering them?

Take your time and


read the questions
carefully.

These questions are


easy marks to get!
Well done!
Video -
Hex Explained

You might also like