Decimal To Hex Conversion

What is a Number System (Decimal and Hexadecimal)?

One of the oldest and most commonly used numbers systems is the decimal system. The hexadecimal number system represents 16 digits.  So to understand these two types of number systems, we need to understand what is a number system first. The number system represents numbers. It can be classified into its subtypes on the basis of the base of that system. A base of a number system plays a significant role in understanding the number system and also helps to convert it from one sub-type to another. Sometimes, a base is also referred to as radix. 

Types Of Number System 

There are four types of number system and in all of them, zero is very crucial as a place holding value. The four types of number system are:

  • The decimal number system

  • The binary number system

  • The octal number system and

  • The hexadecimal number system

Decimal Number System

One of the oldest and most commonly used numbers systems is the decimal system. It is also known as the base 10 number system as it uses 10 digits to represent a number i.e., from 0 to 9. Two significant terms, place value and face value are associated with all the numbers. Face value of a number is the number itself while the place value of a digit is the magnitude it represents. For example, in the number 7896, the face value of the digit 8 is 8 but its place value is 100. Every digit holds a value which is increased by 10 times as we go from right to left. 

For example, the value of 786 is

= 7 x 102 + 8 x 101 + 6 x 100

= 700 + 80 + 6

Hexadecimal Number System

Hexadecimal number system represents 16 digits and thus it is also called the base 16 number system. In this number system, every digit position represents a power of 16. The number system is supplemented by the first 6 letters of the alphabets as well because the base is greater than 10. Thus, the hexadecimal symbols can be represented as 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. The other numbers can be expressed with the help of the combination of the digits and alphabets. Alphabets A, B, C, D, E, F represents digits 10, 11, 12, 13, 14 & 15 respectively. The Hexadecimal number system is mostly used in case of microprocessors and microcontrollers.

Let’s take an example: consider a hexadecimal number 5B52

The decimal equivalent of this number can be calculated by multiplying each digit with 16.

Decimal To Hex Conversion Table

Decimal Number

Hex Number

0

0

1

1

2

2

3

3

4

4

5

5

6

6

7

7

8

8

9

9

10

A

11

B

12

C

13

D

14

E

15

F

16

10

17

11

18

12

19

13

20

14

21

15

22

16

23

17

24

18

25

19

26

1A

27

1B

28

1C

29

1D

30

1E

31

1F

32

20

64

40

128

80

256

100


Decimal To Hexadecimal Conversion With Steps


How Do you Convert decimal to hex? Here is Your Decimal to Hexadecimal Conversion with Steps:


Step 1) Divide the Decimal Number by 16.

Consider 7803 as the decimal number. The first step is to divide it by 16.

7803/16 = 487.6875 

(the outcome is greater than15)


Step 2) Repeat the Process with the Quotient.

487.6875/16 = 30.4804688 ( the outcome is still greater than15, must be divided again)


Step 3) Repeat Until You Get a Quotient Smaller than 16.

30.4804688/16 = 1.9050293

The first decimal digit is 1 i.e., less than 15.


Step 4) Multiply the Remainders by 16.

0.9050293 16 = 14.4804688

0.4804688 16 = 7.6875008

0.6875008 16 =11.0000128

So the resulting digits are 1-14-7-11.


Step 5) Convert the Numbers to Hexadecimal.

In this step we have to refer to the conversion table. So according to the table, 1 and 7 will remain unchanged while 14 will change to E, and 11 will be changed to B.

Put them together as 1E7B. It can also be written as 1E7B16 as a hex number. 

For better convenience follow decimal to the hexadecimal table.

Decimal To Hexadecimal Example Problems

How Do You Convert Decimal to Hex? Well, Here is an Example for You.


Example 1) Convert 4768 to hex

Solution 1) The first step is to divide 4768 by 16 to get 298 (remainder = 0)

Next, we will divide 298 by 16 to get 18.625 (remainder = 0.625)

Then we will further divide18 as it is still greater than 15. So we get the answer 1.125 (remainder = 0.125)

Now, since 1 is smaller than 15, we have got our first number i.e., 1.

Now we multiply the remainders by 16

0.12516 = 2

0.62516 = 10

016 = 0

Therefore, the final answer is 1-2-10-0 which is converted to the hexadecimal system as 12A0.

FAQ (Frequently Asked Questions)

1. How to Convert from Hex to Decimal?

Sol. The symbols in hex A, B, C, D, E, F, are proportional to 10, 11, 12, 13, 14, and 15 respectively. In the hexadecimal system, the number x,y and z means ( X x 162 ) + ( y x 161 ) + ( z x 1600 ). It is the same as ( X x 256 ) + ( y x 16 ) + ( z x 1 ). With that in mind, the number x,y and zwhen converted to decimal gives (10 x 256) + (11 x 16) + (12 x 1). Adding these results makes hexadecimal corresponds to the decimal 2748.

 For example, in base ten i.e., decimal number system, the number 123 means 

( 1 x 102 ) + ( 2 x 101 ) +( 3 x 100 ) or (1 x 100) + (2 x 10) + (3 x 1).

The final results will be 100 + 20 + 3. 

2. What is the Difference Between a Binary and Octal Number System?

Sol. Both binary and octal numbers are used to represent numbers. The only difference between them is that a binary number can only use two digits (0,1) whereas an octal number can use up to 8 digits (0, 1, 2, 3, 4, 5, 6, 7). In other words, we can say that two different numbers in different representations can possibly be equal in value and that it is just another way of writing them. And yes, of course, you can convert any number from one representation to another at any time.