- Home
- Tools
- Math
- Number Base Converter
- Decimal to Hex Converter
Decimal to Hex Converter
Turn a decimal number into hexadecimal, with each division by 16 and its remainder shown.
Type a decimal number in the first field and read it in hexadecimal in the second. It works the other way round as well. Whole numbers only; spaces, underscores and the prefixes 0b, 0o and 0x are fine.
Working
| Division | Result | Remainder |
|---|---|---|
| 2024 ÷ 16 | 126 | 8 |
| 126 ÷ 16 | 7 | 14 = E |
| 7 ÷ 16 | 0 | 7 |
The remainders from the last to the first: 7E8
Other bases
- Bit length
- 11 bits
- Fits in
- 2 bytes
How to convert decimal to hexadecimal by hand
Divide the number by 16 and note the remainder. Do the same with the result, until the result is 0. A remainder from 10 to 15 is written as a letter: 10 is A, 11 is B, 12 is C, 13 is D, 14 is E and 15 is F.
The last remainder is the first digit. For 2024: 2024 ÷ 16 = 126 remainder 8, then 126 ÷ 16 = 7 remainder 14, then 7 ÷ 16 = 0 remainder 7. From the last to the first that is 7, E and 8, so the answer is 7E8.
The working under the two fields at the top of the page does this for whatever number you type.
Good to know
- To check an answer, work it back: 7 × 256 + 14 × 16 + 8 = 2024.
- Numbers up to 255 need at most two hex digits. In bytes and colour codes a single digit gets a zero in front, so 10 is written 0A.
- In program code a hexadecimal number is marked with 0x, as in 0x7E8, so that a number like 10 cannot be mistaken for ten. In hexadecimal, 10 is sixteen.
Decimal to hexadecimal table
| Decimal | Hexadecimal |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 2 |
| 3 | 3 |
| 4 | 4 |
| 5 | 5 |
| 6 | 6 |
| 7 | 7 |
| 8 | 8 |
| 9 | 9 |
| 10 | A |
| 11 | B |
| 12 | C |
| 13 | D |
| 14 | E |
| 15 | F |
| 16 | 10 |
| Decimal | Hexadecimal |
|---|---|
| 20 | 14 |
| 32 | 20 |
| 50 | 32 |
| 64 | 40 |
| 100 | 64 |
| 127 | 7F |
| 128 | 80 |
| 200 | C8 |
| 255 | FF |
| 256 | 100 |
| 500 | 1F4 |
| 512 | 200 |
| 1000 | 3E8 |
| 1024 | 400 |
| 4096 | 1000 |
| 65535 | FFFF |
The number base converter shows binary, octal, decimal and hexadecimal next to each other, and explains positional notation and two's complement.