When dealing with web colors, it's sometimes handy to know what the decimal equivalent of an RGB value. The need to convert numbers back to hex isn't likely to arise as often but why not...
The most common way to convert to hex is repeated division by the base number, 16. Start by dividing the number you want to convert by 16. The remainder becomes the Least Significant Figure (the right-most digit) in the hexadecimal equivalent. Then take the quotient and divide it by 16. The remainder becomes the next significant so write it down to the left of the last remainder. Keep dividing each successive quotient until zero is reached.
For example,
1250
| Division | Quotient | Remainder | Hex |
| 1250/16 | 78 | 2 | 2 |
| 78/16 | 4 | 14 (E) | E2 |
| 4/16 | 0 | 4 | 4E2 |
Using the dollar ($) sign notation to represent hexadecimals. It can be said that from this conversion, the following is true:
1250 = $4E2
Navigate this article:
Intro |
1 |
2 | 3 |
4