How it works
Decimal counts in base 10, hexadecimal counts in base 16. Converting means rewriting the same quantity with a different set of digits — the value never changes, only how it is written.
- Divide the decimal number by 16.
- Write down the remainder — that is the last digit of the hexadecimal number (10–15 are written A–F).
- Repeat with the quotient until it reaches zero, then read the remainders bottom to top.
The reverse conversion is Hexadecimal to Decimal, which also handles every other base pair.
Examples
Worked examples, digit by digit:
- 255 (decimal) = 255 in decimal = FF (hexadecimal)
- 511 (decimal) = 511 in decimal = 1FF (hexadecimal)
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 4 | 100 | 4 | 4 |
| 8 | 1000 | 10 | 8 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 255 | 11111111 | 377 | FF |
Decimal to Hexadecimal: frequently asked questions
- How do I convert decimal to hexadecimal?
- Divide the number by 16 repeatedly and read the remainders from bottom to top. For example, decimal 45 is 2D in hexadecimal. The converter above does this instantly for any value.
- What is 255 in hexadecimal?
- Decimal 255 equals FF in hexadecimal (the value 255, the largest number that fits in one byte).
- Why are decimal and hexadecimal used?
- Decimal (base 10) is the everyday number system. Hexadecimal (base 16) writes each byte as two characters.
