## How to Convert Hexadecimal to Decimal and Vice Versa

Posted in Uncategorized

Like it? Share it! 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 Techspirited article to know more about such conversion methodologies in more detail.

Fast Fact

The term ‘hexadecimal’ is a combination of two words that have Greek and Latin origins, respectively. ‘Hexa’ or ‘hex’ in Greek means ‘six’, and ‘decimal’ means ‘tenth’ in Latin. This numerical system can be represented in more than twenty different forms, depending on the types of languages, software programs, programmed codes, and scripts which are used.

In the hexadecimal numbering system, the numbers consist of a base of 16, and each character can be correlated with sixteen different symbols. These are the numbers ‘0’ to ‘9’ (0, 1, 2, 3, 4, 5, 6, 7, 8, 9) and the letters ‘A’ to ‘F’ (A, B, C, D, E, F). When used in computer systems and for programming, the numbers are represented with the help of a prefix or suffix. For example, a hexadecimal number can be written as 0x 2DC7 or 2DC716, wherein ‘0x’ and ’16’ are a prefix and suffix, respectively.

Four binary digits (called bits) together make up one hexadecimal digit, and one of these is called a nibble (meaning half of an octet or byte, as 8 bits make one byte). This analogy is used to write memory addresses in computing systems, and it is always better to represent coded language in the form of such numbers, instead of the decimal type. This is more convenient when any computing and programming process and tasks are undertaken.

The converter given below will enable you to convert hexadecimal to decimal digits, and vice versa.

Converter

Decimal

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.