We use cookies to give you a better experience. Carry on browsing if you're happy with this, or read our cookies policy for more information.

Skip main navigation

Hexadecimal

Hexadecimal is a convenient way of representing values in computing. This article explains why, and how to convert between denary, binary and hex.
Now you’ll learn the basics of the number system known as hexadecimal: I’ll give you an overview of the digits used to represent hexadecimal numbers, as well as how to convert numbers into hexadecimal from denary or binary.

Why we need hexadecimal

Which of the following numbers is easier to remember?
  • 1100 0101
  • C5
If you think C5 is easier and more convenient to remember and use, you now understand why some binary is expressed in hexadecimal format. Also, as we discussed earlier this week, technology has become very advanced using 1s and 0s, and this is partially because computers can represent very long pieces of data with shorter ones. C5 is actually the same value as 1100 0101, however it is represented as hexadecimal instead of binary.
In previous steps, I explained how different number systems work. Hexadecimal is a base 16 number system: it makes use of 16 numbers. So if we had a creature with 16 fingers, this is how they would count using hexadecimal:
Picture of creature with 16 fingers, each finger counting up from: 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F, 10
This table shows equivalent denary, binary, and hexadecimal values:
DenaryBinaryHex
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F
Hexadecimal is commonly used by computers because it can represent a byte of data with just two characters (instead of eight). Each hexadecimal character represents half a byte, also called a nibble. As hexadecimal is easier for humans to read than binary but is still easy to convert to binary, hexadecimal has a variety of uses, including in error messages, MAC addresses (used to identify a device on a network), character encoding, and RGB colours.

Converting between hexadecimal and binary

Converting between hexadecimal and binary is straightforward: each nibble of binary (half a byte/four bits) corresponds to one hexadecimal character. You can use the table above to convert a hexadecimal symbol to four binary bits, or vice versa.
Going by the table above, the hexadecimal number 7D is converted to binary like this:
  • 7 is equivalent to 0111 (the binary representation of the denary number 7)
  • D is equivalent to 1101 (the binary representation of the denary number 13, which is represented in hexadecimal as D)
  • So hexadecimal 7D is equivalent to binary 0111 1101
Simiarly, the binary number 0001 1010 is converted to hexadecimal like this:
  • 0001 is the binary representation of 1 (which is the same in denary and hexadecimal)
  • 1010 is the binary representation of the denary number 10, which is represented in hexadecimal as A
  • So binary 0001 1010 is equivalent to hexadecimal 1A

Converting hexadecimal to denary, via binary

You already know how to convert binary numbers to denary, and since you just learned how to convert a hexadecimal number to binary, you can also convert it to denary.
For example, the number A9 in hexadecimal is 1010 1001 in binary. And we can convert this to denary using the table we’ve used before:
1286432168421
10101001
128 + 32 + 8 + 1 = 169

Converting hexadecimal directly to denary

We can also convert hexadecimal directly into denary by thinking about the place values. You know that the place values of denary numbers work like this:
1089 = (1 × 1000) + (0 × 100) + (8 × 10) + (9 × 1)
Base 10 place values1000(10**3)100(10**2)10(10**1)1 (10**0)
Denary value1089
Hexadecimal works very similarly, and with base 16 instead of base 10. Let’s convert hexadecimal A9 to denary:
Base 16 place values16 (16**1)1 (16**0)
Hexadecimal valueA9
  • From the table above, we know that hexadecimal A represents denary 10 and hexadecimal 9 represents denary 9
  • Just like in 1089, there is a 9 in the 1 position: (9 × 1)
  • There is a 10 in the 16 position: (10×16)
  • So that means hexadecimal A9 = (10 × 16) + (9 × 1) = 169 in denary.
Base 16 place values16 (16**1)1 (16**0)
Hexadecimal valueA9
Conversion(10 × 16) = 160(9 × 1) = 9

Converting denary to hexadecimal

Let’s convert denary 200 to hexadecimal. We do this by finding out how many times 16 fits into 200 in denary in order to represent 200 in base 16:
  • 200 / 16 = 12, remainder 8
  • So we have 12 lots of 16, with 8 units left over
  • Denary 12 is hexadecimal C, and denary 8 is hexadecimal 8 (check out the table above if you forget)
  • So denary 200 = (12 × 16) + (8 × 1) = C8 in hexadecimal
This article is from the free online

Representing Data with Images and Sound: Bringing Data to Life

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education