How decimal to hex conversion works
To convert a base-10 number to base-16, divide by 16 repeatedly and keep the remainders, replacing 10–15 with A–F. Read the remainders from last to first. For 255: 255÷16=15 remainder 15 (F), then 15÷16=0 remainder 15 (F) → FF. Each hex digit packs four bits, so a byte is always two hex digits.
Because each hex digit is exactly four bits, the two bases line up neatly. Decimal 255 is FF and also 11111111, and any byte is always two hex digits from 00 to FF. That is why colour codes, MAC addresses and memory dumps are written in hex rather than in long runs of 0s and 1s.
For the same task from a slightly different angle, try the binary to decimal calculator.
How to use this calculator
Enter a whole decimal number of 0 or more and read the uppercase hex result. To reverse it, use the hex to decimal calculator.
The calculation runs in your browser, so nothing you enter is uploaded. The result comes without an 0x prefix; add it yourself when pasting into C, Python or JavaScript source, where 0xFF and 255 are the same literal.
When you need something similar but not identical, the RGB to hex converter is there.
Decimal to hex reference table
Common conversions:
| Decimal | Hex |
|---|---|
| 10 | A |
| 15 | F |
| 16 | 10 |
| 255 | FF |
| 256 | 100 |
| 65535 | FFFF |
For base-2 output, see the decimal to binary calculator.
Those anchor values are worth recognising. 255 is one byte at maximum, 65535 is two bytes, and 16777215 is FFFFFF - the white end of a 24-bit colour space. If a number in your data never exceeds one of those, you are almost certainly looking at a fixed-width field rather than a coincidence.
Frequently asked questions
- What is 255 in hex?
- Decimal 255 is FF in hexadecimal — the maximum value stored in one byte.
- How do I convert decimal to hex by hand?
- Divide by 16 repeatedly, note each remainder (using A–F for 10–15), then read the remainders bottom to top.
- Why is hex written with letters?
- Base 16 needs 16 symbols, so A–F stand in for the values 10 through 15 that have no single decimal digit.
- Does this handle decimals or negatives?
- It converts whole numbers of 0 or more. Fractions are rounded down and negatives are not supported here.
- Does the case of the hex output matter?
- No, hex is case-insensitive: FF and ff are the same value. This tool returns uppercase because it is the convention for byte dumps and memory addresses, while CSS colours are usually written lowercase - either is accepted everywhere.