Tuesday, 15 September 2015
DECIMAL TO HEX CONVERTER


Decimal to Hex conversion
Decimal to hex number conversion calculator and how to convert.
Decimal to hex converter
Enter a decimal number and press the Convert button:
How to convert from decimal to hex
For decimal number x:
- Get the highest power of 16 that is less than the decimal number x:
16n < x, (n=1,2,3,...)
- The high hex digit is equal to the integer if the decimal number x divided by the highest power of 16 that is smaller than x:
dn = int(x / 16n)
- Calculate the difference Δ of the number x and the hex digit dn times the power of 16, 16n:
Δ = x - dn × 16n
- Repeat step #1 with the difference result until the result is 0.
Example
Convert x=603 to hex:
n=2, 162=256 < 603
n=3, 163=4096 > 603
So
n = 2
d2 = int(603 / 162) = 2
Δ = 603 - 2×162 = 91
n = 1, x = Δ = 91
d1 = int(91 / 161) = 5
Δ = 91 - 5×161 = 11
n = 0, x = Δ = 11
d0 = int(11 / 160) = 1110 = B16
Δ = 11 - 11×160 = 0
(d2d1d0) = 25B
So
x = 60310 = 25B16
Decimal to hex conversion table
Decimal base 10 |
Hex base 16 |
---|---|
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 |
30 | 1E |
40 | 28 |
50 | 32 |
60 | 3C |
70 | 46 |
80 | 50 |
90 | 5A |
100 | 64 |
200 | C8 |
1000 | 3E8 |
2000 | 7D0 |
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment