About the Decimal to Hex Converter
Hexadecimal is the compact base used for colours, memory addresses, byte values and hashes, because two hex digits map neatly to one byte. This tool converts decimal to hex with arbitrary precision, one number per line. The full Number Base Converter adds an optional 0x prefix and grouping.
Common uses are turning an RGB component into a hex colour digit and reading a decimal address in hex. To reverse, use Hex to Decimal.
One hex digit covers exactly four bits, counting 0 to 9 and then A to F for ten through fifteen. Two digits therefore span 0 to 255, the full range of a byte, which is why byte dumps, colour channels and character codes are all written in pairs. The value 255 comes out as FF, 4096 as 1000, and 16777215 as FFFFFF, the white end of a 24-bit colour.
Padding is the thing to watch, because the output has no fixed width. An RGB channel of 10 converts to A, and dropping that straight into a colour gives you nothing usable: the three channels 10, 10, 10 have to be written #0A0A0A, not #AAA, which is a far lighter grey. Byte offsets in a hex dump are padded to eight digits for the same reason. To see the four bits behind each digit, use Hex to Binary.
How to use
- Paste decimal numbers, one per line.
- Copy the hex results.
- Use the full Base Converter for a 0x prefix.
Common questions
- Is the output uppercase or lowercase?
- Uppercase by default; the full Number Base Converter offers a choice.
- Does it add 0x?
- Not in this simple tool; enable the prefix option in the Number Base Converter.
- How do I make a hex colour?
- Convert each RGB component (0 to 255) and pad each to two digits.