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 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 | | 21 | 15 | | 22 | 16 | | 23 | 17 | | 24 | 18 | | 25 | 19 | | 26 | 1A | | 27 | 1B | | 28 | 1C | | 29 | 1D | | 30 | 1E | | 40 | 28 | | 50 | 32 | | 60 | 3C | | 70 | 46 | | 80 | 50 | | 90 | 5A | | 100 | 64 | | 200 | C8 | | 1000 | 3E8 | | 2000 | 7D0 |