1  Computer Systems / Hexadecimal


hexadecimal
Just like Binary, Hexadecimal is a number system. The main difference is that where Binary is BASE 2 (1 or 0) Hexadecimal is BASE 16. This means that there are 16 different digits / characters used to represent numbers.
Of course there are only 9 different "Numerical" digits available to us  0,1,2,3,4,5,6,7,8 and 9 so.... how can a system use 16 different digits?
Well the answer is that the Hexadecimal number system also makes use of the letters A  F.
In the table below you can see the 16 digits that are used in the Hexadecimal system.
Green row = Denary value
White row = Hexadecimal value
Green row = Denary value
White row = Hexadecimal value
O 
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
O 
1 
2 
3 
4 
5 
6 
7 
8 
9 
A 
B 
C 
D 
E 
F 
Hexadecimal Conversion
To help our understanding of hexadecimal numbers we need to learn how to convert them into different number systems. The types of conversion that we need to know are...
Binary to Hex
Hex to Binary
Denary to Hex
Hex to Denary
Use the tabs below to view each of the conversion methods
Binary to hexadecimal conversion
The Binary to hex conversion process involves converting a base 2 number into base 16.
The process for completing this conversion will be explained using the example Binary number 1101011010
1: The first step is to split your binary number into 4 bits (Nibbles), so 1101011010 will become:



If your binary number does not split into even groups of 4 you simply need to add 0s to the left side until it is even. The above example adds two 0s to change the number from 11  0101  1010 into 0011  0101  1010
2: The next step is to convert each digit into a decimal number using the table structure below:
2 + 1 = 3

4 + 1 = 5

8 + 2 = 10

3: Place the result from each nibble next to each other and you have the Hexadecimal value.
Answer = 3510 BUT BE CAREFUL! any number that is 10 or above must be converted into its Hexadecimal equivalent.
So the answer here would be = 35A as 10 in Hex is A
Answer = 3510 BUT BE CAREFUL! any number that is 10 or above must be converted into its Hexadecimal equivalent.
So the answer here would be = 35A as 10 in Hex is A
Hexadecimal to binary conversion
The Hexadecimal to binary conversion technique works essentially by reversing the methods used to convert binary to hexadecimal.
Lets imagine that we have been asked to convert FA2 (Hex) into a binary number. These are the steps that we must follow.
1: Separate each Hexadecimal digit and convert any letters into their number equivalent (Use the table at the top of the page if you need help)
This would leave us with 15(F)  10(A)  2
Lets imagine that we have been asked to convert FA2 (Hex) into a binary number. These are the steps that we must follow.
1: Separate each Hexadecimal digit and convert any letters into their number equivalent (Use the table at the top of the page if you need help)
This would leave us with 15(F)  10(A)  2
2: The next step is to convert each separate value into a 4 bit binary number (A nibble)
15(F)
=

10(A)
=

2
=

3: The final step is to put all of your nibbles together, thus giving you the answer/ ..
FA2 = 11110100010
Decimal to Hexadecimal conversion
This section will explain the steps necessary to convert a denary (Base 10) number into a hexadecimal (Base 16) number.
There are actually two different ways to successfully convert a denary number into hex. Both will be explained and after practicing you can choose which one works best for you.
There are actually two different ways to successfully convert a denary number into hex. Both will be explained and after practicing you can choose which one works best for you.
Method 1
The first method available is to simply convert the denary number into binary and the convert the binary number into hex.
Lets say we need to convert the denary number 203 into hex.
1: The first step is to convert 203 into Binary. If you are unsure of this conversion method, please refer back to the Binary page, otherwise, the conversion will look something like this...
Lets say we need to convert the denary number 203 into hex.
1: The first step is to convert 203 into Binary. If you are unsure of this conversion method, please refer back to the Binary page, otherwise, the conversion will look something like this...
128 
64 
32 
16 
8 
4 
2 
1 
1 
1 
O 
O 
1 
O 
1 
1 
2: Now that we have the binary number 11001011, the next step is to use the binary to hex conversion method, If you want a deeper explanation of this, refer back to the 'binary to hex' tab. The next conversion step will look like this...
8 + 4 = 12 (C)

8 + 2 + 1 = 11 (B)

Remember that numbers greater than 9 become letters in the hexadecimal system. This means that 12 = C and 11 =B
203 as a Hexadecimal value = CB
203 as a Hexadecimal value = CB
Method 2
The second method available involves repeatedly dividing by 16 and keeping track of the remainder. To demonstrate this we will use the same number as method 1  203
1: The first step is to set up a table with three columns with the following headings...
Value 
/16 
Remainder 
2: The next step is to place the number that you wish to convert into the first available 'Value' row. Next you will move across to the '/16' column, divide the value by 16 and place the answer to 0dp (remember to always round down not up! in this example 203 / 16 is 12.6875 but we still round down as we are more interested in the remainder). Finally place the remainder, if any into the remainder column. If there is no remainder you simply place a 0 in the cell.
Value 
/16 
Remainder 
203 
12 
11 
3: We now move the number in the '/16' (in this case 12) cell below the original value of 203. We will repeat the steps of dividing the value by 16 and keeping the remainder until the number in the 'value' cell is less than 16, when this is the case we simply move the number in 'value' all the way to the 'remainder' cell and move on to the next step...
Value 
/16 
Remainder 
203 
12 
11 
12 
Value 
12 
4: To finish the conversion we take the numbers in the 'remainder' column starting from the bottom and working from the top. In this case we end up with 12 and 11. Remember that in Hexadecimal, 12 Becomes C and 11 Becomes B.
203 as a Hexadecimal value = CB
203 as a Hexadecimal value = CB
Hexadecimal to decimal conversion
This section will explain the steps that you need to take to convert a hexadecimal value (Base 16) into a denary (Base 10) number.
The current syllabus states that the maximum sized hexadecimal number that you will be asked to convert into denary is a 4 digit value.
With this in mind we will use a 4 digit Hex value as our example. We are Going to convert the Hex value A4F3 into Denary
The current syllabus states that the maximum sized hexadecimal number that you will be asked to convert into denary is a 4 digit value.
With this in mind we will use a 4 digit Hex value as our example. We are Going to convert the Hex value A4F3 into Denary
1: The fist step for this conversion is to create a table similar to the one used in binary conversions. Unlike the binary table, we do not start at 1 and double. This time we start with "units" then Multiply by 16 moving from right to left...
256 X 16 
16 X 16 
Units X 16 
Units 
4096 
256 
16 
Units 
2: When we have created our table headings, the next step, just like with binary conversions, is to place our hex value (A4F3) beneath them...
4096 
256 
16 
Units 
A 
4 
F 
3 
3: Next we multiply Each column heading by the hex value beneath it, Except for the units column... this stays as its own number.
4096 
256 
16 
Units 
4096 X A(10) 
256 X 4 
16 X F(15) 
3 
40960 
1024 
240 
3 
4: The final step is to add the result from each multiplication together and we have our answer!
40960 + 1024 + 240 + 3 = 42,227  So A4F3 = 42227
40960 + 1024 + 240 + 3 = 42,227  So A4F3 = 42227
Video Explanation
Please enjoy this video created by three of my students (Yeonwoo, Mathis and Phukhao) as they explain the process using the Hex value 6C4.
Please enjoy this video created by three of my students (Yeonwoo, Mathis and Phukhao) as they explain the process using the Hex value 6C4.