In this tutorial we will learn to convert a decimal number into hexadecimal number.

Before we dive into the main topic lets talk a little about Decimal and Hexadecimal Number System that we are going to work with in this tutorial.

A decimal number system consists of 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. So, any number that we use in our daily life is actually in decimal number system.

In hexadecimal number system we use ten digits and six english alphabet letters.

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F

10 is denoted as A

11 is denoted as B

12 is denoted as C

13 is denoted as D

14 is denoted as E

15 is denoted as F

Hexadecimal implies base 16

To convert a decimal number into hexadecimal we divide the number by 16 till the dividend becomes less than 16.

Convert decimal number 20 into hexadecimal form.

So, our dividend is 20 and as we are finding hexadecimal of 20 so we will divide it by 16. Thus, the divisor is 16.

```
Step 1
----------------
Dividend = 20
Divisor = 16
Quotient = 1
16 ) 20 ( 1
16
----
4
Dividing 20 by 16 we will get 4 as remainder.
So, 1st remainder = 4
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 1
Step 2
-----------------
Dividend = 1
As, dividend is less than 16 so, we will stop here and copy the dividend as the last remainder.
So, 2nd remaider = 1
```

The calculated remainder are as followed.

1st remainder = 4

2nd remainder = 1

To find the hexadecimal we have to scan the remainder from bottom.

So, 20_{(base 10)} = 14_{(base 16)}

Alternatively, (20)_{10} = (14)_{16}

Where, (base 10) means the number is in decimal number system and (base 16) means the number is in hexadecimal number system.

Convert decimal number 110 into hexadecimal form.

So, our dividend is 110 and the divisor is 16.

```
Step 1
----------------
Dividend = 110
Divisor = 16
Quotient = 6
16 ) 110 ( 6
96
-----
14
Dividing 110 by 16 we will get 14 as remainder.
So, 1st remainder = 14 (In hexadecimal form 14 = E)
Dividend for step 2 = quotient of step 1
So, dividend for step 2 = 6
Step 2
----------------
Dividend = 6
As, dividend is less than 16 so, we will stop here and copy the dividend as the last remainder.
So, 2nd remaider = 6
```

The calculated remainder are as followed.

1st remainder = 14 = E

2nd remainder = 6

To find the hexadecimal we have to scan the remainder from bottom.

So, 110_{(base 10)} = 6E_{(base 16)}

Alternatively, (110)_{10} = (6E)_{16}

Recently Added

- jQuery - Event propagation jQuery
- jQuery - Event delegation jQuery
- jQuery - Handling Events jQuery
- jQuery - Wrap elements and Remove elements jQuery
- jQuery - Adding elements outside existing elements jQuery
- jQuery - Adding elements inside existing elements jQuery
- jQuery - Property method jQuery
- jQuery - Attribute method jQuery
- jQuery - Styling DOM jQuery
- jQuery - Chaining Methods jQuery