How to convert decimal to hex
- Type the number in the "Decimal (base 10)" field.
- See the result in "Hexadecimal (base 16)", highlighted.
- You also get the binary and octal of the same number.
- Tap Copy to take the results with you.
The method and an example
Divide the number by 16 again and again and write down the remainders (10 to 15 are written A to F), read from bottom to top. For example, 255 ÷ 16 = 15 remainder 15; 15 ÷ 16 = 0 remainder 15. The remainders 15 and 15 are F and F: FF.
Another example: 26 ÷ 16 = 1 remainder 10, so 26 is 1A. The table below shows the first numbers in all four bases.
| Decimal (base 10) | Binary (base 2) | Octal (base 8) | Hexadecimal (base 16) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 17 | 10001 | 21 | 11 |
| 18 | 10010 | 22 | 12 |
| 19 | 10011 | 23 | 13 |
| 20 | 10100 | 24 | 14 |
| 21 | 10101 | 25 | 15 |
| 22 | 10110 | 26 | 16 |
| 23 | 10111 | 27 | 17 |
| 24 | 11000 | 30 | 18 |
| 25 | 11001 | 31 | 19 |
| 26 | 11010 | 32 | 1A |
| 27 | 11011 | 33 | 1B |
| 28 | 11100 | 34 | 1C |
| 29 | 11101 | 35 | 1D |
| 30 | 11110 | 36 | 1E |
| 31 | 11111 | 37 | 1F |
| 32 | 100000 | 40 | 20 |
| 40 | 101000 | 50 | 28 |
| 50 | 110010 | 62 | 32 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 200 | 11001000 | 310 | C8 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 500 | 111110100 | 764 | 1F4 |
| 512 | 1000000000 | 1000 | 200 |
| 1000 | 1111101000 | 1750 | 3E8 |
| 1024 | 10000000000 | 2000 | 400 |
| 4096 | 1000000000000 | 10000 | 1000 |
| 65535 | 1111111111111111 | 177777 | FFFF |
Good to know
- Only positive whole numbers are converted.
- There is no size limit: arbitrary-precision numbers are used.
- The result is shown in capital letters, without the 0x prefix.
Frequently asked questions
How do I convert 255 to hexadecimal?
Divide by 16: the result is FF.
What is 16 in hexadecimal?
10, read "one zero", meaning one 16 plus zero units.
Does it work for web colors?
Yes: convert each component from 0 to 255 and join them as #RRGGBB.
Is my data sent to a server?
No. The conversion happens in your browser.