How to convert decimal to hex
- Type a decimal number.
- Copy the hexadecimal result. Add
0xin front for most programming languages, or#for CSS colors.
The method
Divide by 16 repeatedly and write down the remainders, using A–F for 10–15, then read them from bottom to top. For 255: 255 ÷ 16 = 15 remainder 15 (F), 15 ÷ 16 = 0 remainder 15 (F), giving FF. For 4096: 4096 = 16³, so it is 1000 in hex.
| Decimal | Hex |
|---|---|
| 10 | A |
| 15 | F |
| 16 | 10 |
| 32 | 20 |
| 100 | 64 |
| 128 | 80 |
| 200 | C8 |
| 255 | FF |
| 256 | 100 |
| 1000 | 3E8 |
| 4096 | 1000 |
| 65535 | FFFF |
Hex is the standard shorthand for bytes: each hex digit is 4 bits, so a byte is always two hex digits from 00 to FF. That is why web colors such as #FF8000 are written in hex: FF red, 80 green, 00 blue (255, 128, 0). Programmers use hex for memory addresses, error codes, Unicode code points and file signatures. The converter uses exact integers, so even 64-bit values are correct.
FAQ
What is 255 in hex?
FF.
How do I convert an RGB color to hex?
Convert each channel (0–255) to two hex digits and join them: rgb(255, 128, 0) is #FF8000. The color converter does this for you.
Is hex case-sensitive?
No. FF and ff are the same value; uppercase is common in documentation and lowercase in CSS and code.