Enter a value below — binary and octal come along free
Type in any field — the others update as you type.
| Hex | Decimal | Hex | Decimal |
|---|---|---|---|
| 0 | 0 | ||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | 9 | ||
| A | 10 | ||
| B | 11 | ||
| C | 12 |
To convert a decimal number to hexadecimal, divide by 16 repeatedly and collect the remainders. Each remainder is one hex digit, produced right to left:
Convert 419 to hex:
So 419 in decimal is 1A3 in hex. A quick sanity check in reverse: 1×256 + 10×16 + 3 = 419.
Decimal is what humans count in; hex is a compact way to write what machines store. One byte holds values 0–255, which is exactly two hex digits — so hex lines up with the hardware in a way decimal never does:
Where the hex value goes matters as much as the digits:
The digits are identical in all three — only the costume changes. And when a value must occupy a fixed width, pad with leading zeros: 255 as a two-byte value is 00FF, not FF.
255 in decimal is FF in hexadecimal: 255 ÷ 16 = 15 remainder 15, and 15 is written F, giving FF. It is the highest value a single byte can store.
Divide the number by 16 repeatedly, keeping each remainder. Write the remainders in reverse order, using the letters A through F for remainders 10 through 15.
Convert each channel (0–255) to two hex digits and join them behind a #. For example red 255, green 102, blue 0 becomes #FF6600. Pad values under 16 with a leading zero: 10 becomes 0A.
When a value must fill a fixed width — two digits per color channel, or a fixed-size field in a protocol — you pad with zeros on the left. The number 255 as a two-byte field is 00FF; the zeros change the width, not the value.
Going the other way? Use the Hex to Decimal Converter.