Decimal to Hex Converter
Enter a decimal number and its hexadecimal form appears as you type. The guide below explains the divide-by-16 method and the quirks of fractions and very large values.
Related converters
Created by the Reeliy Editorial Team. Last updated: Oct 19, 2026
How decimals become hexadecimal
Hexadecimal is a base-16 system. Each position is worth a power of 16 (1, 16, 256, 4096 and so on), and since a single digit has to cover 16 values, the letters a to f stand for 10 to 15. A two-digit hex number therefore covers 0 to 255, which is exactly one byte.
Hex is popular because it is compact: a number that needs eight binary digits fits in two hex digits. You will see it in web colours such as #ff8800, in memory addresses and in character codes.
How to convert decimal to hex
For a whole number, divide repeatedly by 16. Each remainder is a hex digit (turn 10 to 15 into a to f), and the quotient is divided again until it reaches 0. Read the remainders from last to first.
Example: convert 1000. 1000 ÷ 16 = 62 remainder 8; 62 ÷ 16 = 3 remainder 14 (written e); 3 ÷ 16 = 0 remainder 3. Reading backwards gives 3e8. Check: 3 × 256 + 14 × 16 + 8 = 768 + 224 + 8 = 1000.
Another example: 48879 gives remainders 15, 14, 14, 11 from first to last. Backwards that is b, e, e, f, so the hex value is beef.
For a fractional part, multiply by 16 and keep the whole-number part each time. 0.75 × 16 = 12, which is c with nothing left over, so 0.75 is 0.c in hex.
What the converter shows
- Lowercase letters and no 0x prefix. Add the prefix yourself if your code needs it.
- Negative numbers get a minus sign in front of the hex form of their magnitude, so −255 becomes −ff. This is not a two's complement byte.
- Fractions are expanded digit by digit. 0.5 is 0.8, but a value like 10.1 does not end in hex, so the tool prints the digits of the double-precision number nearest to it (a.1999999999998).
- Large integers lose precision above 9007199254740991 (2^53 − 1). The number 12345678901234567890 is really ab54a98ceb1f0ad2 in hex, but the converter shows ab54a98ceb1f0800 because the input is stored as a double first.
- An empty box counts as 0.
Decimal to hex conversion table
| Decimal | Hex |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 9 | 9 |
| 10 | a |
| 11 | b |
| 12 | c |
| 13 | d |
| 14 | e |
| 15 | f |
| 16 | 10 |
| 17 | 11 |
| 32 | 20 |
| 64 | 40 |
| 100 | 64 |
| 128 | 80 |
| 200 | c8 |
| 255 | ff |
| 256 | 100 |
| 1000 | 3e8 |
| 4095 | fff |
| 65535 | ffff |
Related conversions
To turn hex back into a decimal number, use the hex to decimal converter. The decimal to binary converter shows the same number in base 2, and the hexadecimal calculator adds, subtracts, multiplies and divides hex values directly.
Frequently asked questions
How do I convert 255 to hex?
Divide by 16: 255 ÷ 16 = 15 remainder 15. Both the quotient and the remainder are 15, which is f, so 255 is ff in hex.
Why does hex use letters?
A digit in base 16 must stand for sixteen different values, but we only have ten numerals. The letters a to f cover the values 10 to 15.
Why are the last digits of a huge number all zeros?
The tool keeps your input as a double-precision number, which has 53 significant bits. Past 9007199254740991 some low bits cannot be stored, and they come out as zeros.
Does the output include the 0x prefix?
No. The result is only the digits. In most programming languages you add 0x in front to mark the value as hexadecimal.
References
- Donald E. Knuth, The Art of Computer Programming, Volume 2: Seminumerical Algorithms, section 4.1 (Positional Number Systems)
Cite this converter and page
If you use this page in your work, you can cite it as:
Reeliy Editorial Team. (2026). Decimal to Hex Converter. Reeliy. https://reeliy.com/converters/convert-decimal-to-hex“Decimal to Hex Converter.” Reeliy, 2026, https://reeliy.com/converters/convert-decimal-to-hex.