What is a Hexadecimal Number?
The easiest way to understand what a hexadecimal number is is to compare it to something you already know -- a decimal number. As you know, a decimal number uses the base 10 system for counting and expressing value. It's called "base 10" because it uses ten digits (0,1,2,3,4,5,6,7,8,9) to count and express values.
The hexadecimal system, on the other hand, uses the base-16 method for counting and expressing value. It's called "base 16" because it uses 16 digits to count and express value. However, since we only have 10 numeric characters to work with, the hexadecimal system uses letters to express values that are greater than 9.
Here is how the base 16 (hexadecimal) numbering system compares to the base 10 numbering system you are accustomed to:
Now, since we are looking to convert a base 10 number into a base 16 number, let's compare the base 10 place values to the place values in a base 16 system:
So you see, since each place value in a base 10 number is different than the corresponding place value in a base 16 system, we need a method for converting 0-9 base 10 place values into 0-F base 16 place values.
How to Convert Decimal to Hexadecimal
To convert a base 10 number into a base 16 number, the first step is to find the first base 16 place value that is greater than or equal to the decimal number you are converting -- starting at the 160 place and working your way to the left. For example, suppose you want to convert the decimal number 125 into a hexadecimal number. In that case, you would find the first base 16 place value that is greater than or equal to 125, which would be 256:
Once you have located your base 16 place value starting point, the next step is to create a conversion chart, like this:
Next, attempt to divide the amount in row B into the amount in row C. If the amount in row C is greater than the amount in row B, enter a "0" in row D and move the amount in row B one cell to the right. Otherwise, if the amount in row C is less than the amount in row B, enter the number of times row C goes into row B in row D and enter the remainder in the next open cell in row B. Then simply repeat this process for each subsequent column. Finally, change all numbers in row D that are greater than 9 to their letter equivalent (10=A, 11=B, 12=C, 13=D, 14=E, and 15=F). Here is how the completed conversion chart would look:
From the above, we can see that the base 10 number 125 converts to the base 16 number 7D (7*16 + 13*1 = 125). Note that the leading zeros are dropped since they represent no value (just like the base 10 system).
As you can see, converting a decimal number to a hexadecimal number is a simple process of identifying the first base 16 place value greater than or equal to the base 10 number you are converting, and then dividing each place value into the remainder of previous division.