how to convert hexadecimal to decimal and vice versa

How to Convert Hexadecimal to Decimal and Vice Versa

The hexadecimal system of numbering is used in computing systems and other fields like mathematics and language coding. For simplification, these numbers are converted into decimal digits, and the opposite process is also possible. Read this Buzzle article to know more about such conversion methodologies in more detail.

In order to convert hexadecimal numbers into decimal ones, and vice versa, it is crucial to understand a few basics regarding the methodology. Thus, in the following sections, the methods, basics, formula, etc., have been explained with the help of examples. Have a look at the reference conversion chart given below before proceeding.
Corellation Charts for Hexadecimal and Decimal Conversions
Number Chart
Hexadecimal Decimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
Alphabet Chart
Hexadecimal Decimal
A 10
B 11
C 12
D 13
E 14
F 15
How to Convert Hexadecimal to Decimal
Step 1
Each individual number in a hexadecimal form corresponds to its specific symbol. Thus, write the number in the form of its representative symbol, and put additional signs in between.
Step 2
Each number is then multiplied by the nth power of 16, which depends on the position of the number in the expanded form.
Step 3
The nth power depends upon the positional variation of the particular number. If it is in the hundred's position, the exponential will be 2, in case of ten's position it will be 1, and in unit's position, it will be 0.
Step 4
After multiplying all the values with the respective numbers, add them to get the final answer, which is the decimal form of the original hex number. Take a look at the following examples to understand the method in more detail.
Example No. 1
The given hexadecimal number is 6FD16. Find out its decimal form. Firstly, by referring to the above chart, the expanded form of this number can be written as: (6 × 162) + (15 × 161) + (13 × 160) Thus, after the multiplication of base sixteen with the corresponding exponential values, the expression is written as: (6 × 256) + (15 × 16) + (13 × 1) = 1536 + 240 + 13 = 1789 (the final decimal number)
Example No. 2
The given hexadecimal number is BE83C16. Using the above mentioned steps, convert the expression into a decimal number. By writing the base 16 exponential values, the expression changes in the following manner: (11 × 164) + (14 × 163) + (8 × 162) + (3 × 161) + (12 × 160) The form is simplified by multiplication, and is written as: (11 × 65536) + (14 × 4096) + (8 × 256) + (3 × 16) + (12 × 1) = 720896 + 57344 + 2048 + 48 + 12 = 780348 (the final decimal number)
How to Convert Decimal to Hexadecimal
Step 1
First, find out the highest value of base 16 that is less than the given decimal number.
Step 2
If the number is divided by this power, then the highest value of the hex digit is equal to an integer.
Step 3
The difference between the number and the multiplied value of the hex digit and the exponential power of base 16 is to be calculated.
Step 4
Continue to calculate the individual digits till you get zero value. Note down the individual numbers, and by correlating them with the chart, you will get the hexadecimal representations.
Example
The given decimal number is 617. Follow the steps given above and convert it into a hex form. According to the first step, the square of 16 will be less than 617. Hence the value of 'n' is taken to be 2. Now, the hex digit can be found out in the following manner: d2 = In (617 ÷ 162) = 2 The difference calculated will give us the value of the hex digit: diff = 617 - (162 × 2) = 617 - 512 = 105 In the next step, the number is now taken as 105. Thus, the exponential power of 16 is taken as 1, as its square is greater than 105. The calculations are given below: d1 = In (105 ÷ 161) = 6 diff = 105 - (6 × 161) = 105 - 96 = 9 By taking the number value as 9, the exponential of base 16 is 0. d0 = 9 - (9 × 160) = 9 - 9 =0 Thus, the hex value integers that are obtained from this method are '2', '6', and '9'. By referring to the correlation chart given above, the hexadecimal representation of 617 is '269'.
The above methods deal with simplicity regarding the conversion between hexadecimal and decimal units and numbers. Ensure that you always refer to the conversion chart, as even a small error or a mistake in the calculations will give out completely different results. This aspect needs to be strictly followed, especially by those who are into programming and coding. A small deviation might cause the entire code to go wrong.

Похожие статьи