Decimal to Hexa and Hexa to Decimal Conversion with Example

To count objects, to do a calculation, etc… we use numbers. For centuries, various cultures have used different representations and methods of numbering. People started to count numbers using fingers. But this method was ineffective where large calculations have to be done. The concept of the positional numbering system and use of zero for calculation emerged from the Hindu manuscripts of the 1st to 4th centuries. The symbols that we use today for the representation of numbers are originated from the Hindu-Arabic system invented by Indian Mathematicians. It is a Decimal Numerical System. Later on Binary System, Hexadecimal system, octal system, etc..are introduced. In this article, let us know the Decimal to Hexa and vice-verse conversions.


What is a Decimal Numbering System?

It is a standard numbering system used for representing integers and non-integers. It is originated from the Hindu-Arabic Numbering System. Decimal Numbering System uses 10 symbols for representing numbers. They are 0,1, 2, 3, 4, 5, 6, 7, 8, 9.

Using decimal numbering system numbers such as integers, non-integers, fractions, real numbers, etc.. can be represented easily. It is also known as Base-10 positional numbering as the powers of 10 are used for representing numbers at different place-values.

For representing a non-negative number, minus sign is used before the number ‘-‘. For representing fractional numbers a dot is used as the decimal separator’.’. Decimal numbering system can also represent the infinite sequence, terminating decimals, repeating decimals, etc..

Uses of Decimal Numbering System

For its simplicity, the decimal numbering system is adapted today as the standard system for the representation of numbers. Using this numbering system many algebraic calculations can be solved easily. This system is also very helpful for doing arithmetic calculations. It gives the best way of representing infinite numbers and fractions.

What is a Hexadecimal Numbering System?

The word Hexa is a Greek word, which means six. The hexadecimal numbering system is a positional numbering system that uses 16 symbols for representing numbers. They are 0, 1, 2, 3, 4, 5, 6, 7,8, 9, A B, C, D, E, F. The alphabets A-F are used to represent numbers from ten to fifteen.

When represented in binary form, each hexadecimal is represented using four binary bits. The hexadecimal numbering system is a base-16 positional system as it uses the powers of 16 for calculating the value of the number. A prefix ‘0X’ is used before the numerical to denote it as a hexadecimal number. For example, ’25’ is a decimal number whereas’0X25′ is a hexadecimal number.

Use of Hexadecimal Numbering System

Hexadecimal numbering is highly preferred by computer programmers and designers. This system of numbering is used in computer programming to represent large numbers. It also provides a human-friendly representation of huge numbers making it easier to interpret.  This system is also used for representing negative numbers and floating points in computer programming. Modern electronics use hexadecimal representation for instruction sets. Elementary arithmetic operations can be performed directly on Hexadecimals. This system can also represent decimals and exponentials in calculations.

Decimal to Hexa Conversion Method

For our day-to-day calculations, decimal numbering is used for representing numbers. But the computer system and electronics use binary and hexadecimal numbering for instructions. So, it is necessary to know the relationship between decimal and hexadecimal systems.

For Decimal to Hexa conversion, some steps have to be followed. Initially, the decimal number has to be divide with 16. Its quotient is written below and the remainder is noted. This remainder will be used for hexadecimal representation. Now, again divide the quotient with 16 and follow the above process. Continue this division until the quotient becomes zero. If the obtained remainder values are among 10, 11, 12, 13, 14, 15 represent them with  A, B, C, D, E, F respectively. Now write down the remainder from bottom-up. The number sequence now obtained will be the hexadecimal representation of the given decimal number.

Decimal to Hexa Conversion Example

The conversion of decimal number to hexadecimal is explained above. Let us look at an example by converting the decimal number 2545 into a Hexadecimal.

Step1: Divide the number with 16 and note down its quotient and remainder.

Step2: Repeat the above step till the quotient becomes zero.

Step3: For remainders greater than 9, represent them with Hexadecimal symbol.

Step4: Note down the remainders from the bottom-up to form the hexadecimal number.

Decimal-To-Hexa-Conversion-Example
Decimal-To-Hexa-Conversion-Example

Hexa to Decimal Conversion Method

For interpretation of hexadecimal numbers, and to do calculations on them,  they have to be converted into decimal form. The table below represents the Hexa-decimal digits and is useful for conversion.

Decimal-To-Hexadecimal-Conversion-Table
Decimal-To-Hexadecimal-Conversion-Table

The first step in the conversion of hexadecimal number into decimal is to write the decimal equivalents for hexadecimal digits from the conversion table. Then multiply each of the decimal equivalents with the 16 power of digit location. After multiplying all the digits, add all the multipliers. The resultant number gives the decimal conversion of the hexadecimal number.

Hexa to Decimal Conversion with Example

The conversion process for hexadecimal to decimal conversion is as shown above. Let us convert a hexadecimal number 253A into decimal.

Step1: write the decimal equivalent of the hexadecimal digits.

A = 10: 3 = 3: 5 = 5: 2 =2 from the conversion table given above.

Step2: Multiply the digits with 16 power of their place value.

In the example, the place value of A is 0. So, it should be multiplied with 160, which equals to 1. Thus 10 ×1 = 10. Similarly, the place value of 3 is 1, the place value of 5 is 2, the place value of 2 is 3. After multiplication, add all the multipliers.

= 2×163 + 5×162 + 3×161 +10×160

=2×4096 +5×256 +3×16+10×1

=8192 + 1280 + 48 + 10

= 9530

Thus, the decimal conversion of the given hexadecimal number 253A is 9530.

There are many software tools available online for direct hexadecimal to decimal conversion and vice-versa. For hardware implementation, the hexadecimal to binary encoder converts the number into binary which further converted to a decimal using a binary-decimal decoder.

Machines cannot understand human language. They can understand only 0’s and 1’s. To make the machines understand the human language, it has to be converted into machine language. Binary numbering, Hexadecimal numbering, Octal Numbering, etc.. are the machine-based numbering formats. Whatever be the numbering representation used for programming, internally it should be converted into binary, for interpretation and storing of data by machines. What is the decimal representation of the hexadecimal ‘5E’?