Decimal to Hex Converter
Convert a decimal number to its exact hexadecimal value, handling arbitrarily large integers correctly.
Enter a decimal number below - this tool converts it to hexadecimal exactly.
Supports integers up to 2^53-1 (JavaScript's safe integer limit) - for larger values, precision beyond this range cannot be guaranteed.
More Data / Number / Computer Science Tools
View all 19For the reverse direction, see the Hex to Decimal Converter.
How Decimal-to-Hex Conversion Works
The number is repeatedly divided by 16, with each remainder (0-15, represented as 0-9 and A-F) recorded - reading the remainders from last to first gives the hex representation.
How to Use It
- Enter a non-negative integer.
- The hexadecimal equivalent appears instantly.
Limitations
This handles arbitrarily large integers accurately using BigInt, avoiding the precision loss standard JavaScript number handling would introduce for very large values.
Worked Example
Convert 3054 to hexadecimal:
- 3054 ÷ 16 = 190, remainder 14 (E)
- 190 ÷ 16 = 11, remainder 14 (E)
- 11 ÷ 16 = 0, remainder 11 (B)
Reading the remainders from last to first gives BEE, often written 0xBEE.
Hex Digits
| Decimal | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|
| Hex | A | B | C | D | E | F |
Where Hex Is Used
- Colours: in
#FF8800, each pair is a channel from 0 to 255 - FF = 255, 88 = 136, 00 = 0. - Memory addresses and byte values in debuggers and hex editors.
- Unicode code points such as U+20B9 (₹).
- Hashes and IDs: MD5, SHA-256 and UUIDs are written in hex.
Each hex digit is exactly four bits, which is why hex is a compact way to write binary: F = 1111, FF = one byte.
Go back with Hex to Decimal, or convert between any bases with the Number Base Converter.
Frequently Asked Questions
Explore More Tools
Keep going with related categories and our most used tools.