Decimal to Hex and Hex to Decimal conversions are the mostly widely used one in processors. Both systems belongs to represent the number in different codes. Based on the number of digits present the respective base of the system is defined. The Decimal system consists of ten digits that are from 0 to 9. The Hexadecimal system consists of 16 digits from 0 to F.

The conversion from the other base numbering system like octal,binary,hexa to decimal can be done through one of the method called the Positional Method. In this system, the rightmost bit is known as LSB. The last bit at the left is treated as MSB. With the help of this, base values are applied and powers are raised on it. The conversion of Decimal into other bases requires the division of the number with the respective base.

## Decimal Numbering System and Hexadecimal Numbering System

The type of conversion from Decimal to Hex and Hex to Decimal is termed to be very simple and easy to analyze. This can be done by using the Tabular Chart. It consists of values of decimals as well as hexadecimal. By remembering the chart we can proceed with the conversions. To convert them by manual calculation the number that is in Decimal form to Hexadecimal from 1 to 15 is easy. But the numbers greater than 15 can be converted by dividing that particular value with 16.

Because 16 is the radix of the Hexadecimal System. The remainder obtained after dividing with 16 is considered to be the ‘Equivalent Hex Number’ . The numbers from 0 to 9 are represented in the same way as the decimal number in Hex. But the remaining values from 10 to 15 are represented from A to F Characters. There are various Digital Converters available online. By simply inserting the value the format of one code is changes to another.

### Decimal to Hex Conversion

The conversion can be done with the table. but the steps involved in this conversion are:

- In this step, the given value of decimal must be divided into the radix value of the system. That is ’16’.
- The Remainder is kept aside.
- Further, the obtained quotient is divided with the value ’16’. This process continues until the quotient value reaches ‘0’.
- Then the remainders obtained in each case of division are taken in the ‘Reverse Order’.

Then the reversely order arranged value can be termed as the hexadecimal number. It can be understandable by microcontrollers and processors.

#### Examples

The above conversions can be analyzed by solving further examples.

- Convert 54 Decimal into Hex

- The conversions begin by dividing 54 with 16. The division results in the quotient of 3 and the remainder as 6.
- As per the process followed the value obtained at the remainder is kept aside.
- The quotient obtained is further divided by 16. when 3 is divided the quotient obtained is 0.
- The remainder value will be 3.
- By writing the values of remainder in reverse. The resultant Hex value is 36.

Hence the decimal value of 54 is 36 in hex.

2. Convert 980 Decimal into Hex

- As per the procedure, the decimal value 980 must be divided by 16.
- The quotient obtained for the first step of division is 60. The remainder is 20.
- The remainder is left for the final step. But the quotient 60 is divided further by 16.
- On dividing 60 with 16. The quotient obtained is 3 and the remainder is 12.
- Further, the quotient 3 is divided by 16.
- Finally, the quotient obtained is 0 and the remainder is 3.
- Now write the remainders in reverse order. The value obtained is 31220.
- The first remainder 20 is greater than 15. In such a case, it must be converted into hex by the division method.
- The hex value 20 can be written as 14. Such that ‘1’ is the carry and 4 is the final digit. Then 12 becomes 13 due to carry.
- Finally, the Equivalent Hex Number is 3D4.

Hence the Conversions can be obtained for Decimal to Hex by following the above process.

### Hex to Decimal Conversion

For converting decimal to hex we have followed the procedure of division. To convert the Hex value into decimal we have to multiply the value 16 based on the positions. The LSB value without any decimal point must be multiplied with 16 power raised to 0. Further, the other digits towards MSB must be multiplied with the value of 16 in an increasing order of it.

#### Example

- Convert 65C Hex value into Decimal

- The Conversion can be possible by multiplying the 16 to the respective positions.
- The values positioning must be starting from C.

6 5 C

16^2 16^1 16^0

- C*16^0= C*1=C. The C value in decimal is 12.
- 5*16^1=5*16=80.
- 6*16^2=6*16*16=1536

Finally, by adding the results the value obtained is

1536+80+12=1628

65C Hex value can be written as 1628 in Decimal.

2.Convert 5C3 Hex value into Decimal

- The same multiplication process is followed based on the positions.
- The positioning starts from 3 that is the LSB digit.

5 C 3

16^2 16^1 16^0

- 3*16^0=3*1=3.
- C*16^1=C*16. C in decimal is 12. That is 12*16 = 192.
- 5*16^2=5*16*16=1280.

Finally, the resultant can be obtained by summing up the individual values.

3+192+1280=1475

5C3 Hex can be written as 1475 in Decimal.

### Decimal to Hex Conversion Table

The conversion table consists of decimal numbers and their equivalents in terms of Hexadecimals. The decimals constitute of 0 to 9. A similar representation is used in Hexadecimal. But after 9 the alphabets are used in representation till 15. However after 15 further numbers must be simplified by using carry methods and the values are converted.

Let us consider the example of 20. 20 is greater than 15. It doesn’t have any alphabetic representation. This further simplified by dividing with radix value of the required numbering system. The resultant is 14 when the Hexadecimal system is considered. Where 1 is used for carrying and increment the previous value.

### Encoder

Encoders are the circuits that are known for converting one code into another. This Conversions can be chosen based on the requirement of the operation. These circuits are placed at the input sides.

In various languages of programming, the programs are written to convert Decimal to Hex and vice-versa. There are various programs based on the required conversions available in various languages. Like Encoders, there are Decoders to retain the previous numbering format. Can you convert 1435 that is Decimal Value into Hex and verify it by converting it back from Hex to Decimal?