About this tool
Convert decimal numbers to hexadecimal (base 16), the compact notation programmers use for bytes, memory addresses, colours, Unicode code points and permissions. Enter one number per line; add a 0x prefix or group the digits into bytes with the format options.
How to convert decimal to hex by hand
Divide by 16 repeatedly and write down the remainders as hex digits (10 = A … 15 = F), then read them from last to first:
500 ÷ 16 = 31 remainder 4 → 4
31 ÷ 16 = 1 remainder 15 → F
1 ÷ 16 = 0 remainder 1 → 1 → 0x1F4
Why hexadecimal?
One hex digit is exactly 4 bits, so two digits are one byte: FF = 11111111. That makes hex far easier to read than binary while still mapping directly onto bits, which is why it’s used in hex dumps, colour codes (#FF8800), MAC addresses, hashes and error codes.
Negative numbers
Choose a bit width to get the two’s complement form used in memory and debuggers: −1 in 32 bits is FFFFFFFF, and −2 in 16 bits is FFFE.
Features
- Any size: numbers are converted exactly with arbitrary-precision arithmetic, so 64-bit values and even longer numbers never lose digits (a normal calculator rounds anything above 253).
- Fractions:
3.75→11.11. Fractions that don’t end in the target base, like 0.1 in binary, are cut off after the chosen number of digits and marked with…. - Negative numbers with a minus sign, or as two’s complement in 8, 16, 32 or 64 bits, the way computers store signed integers.
- Flexible input: prefixes (
0b,0o,0x,#), spaces, underscores and thousands separators are ignored. Convert many numbers at once, one per line. - The first number is also shown in every base, with the number of bits it needs.
Quick reference
| Decimal | Binary | Octal | Hex |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 32 | 100000 | 40 | 20 |
| 64 | 1000000 | 100 | 40 |
| 100 | 1100100 | 144 | 64 |
| 127 | 1111111 | 177 | 7F |
| 128 | 10000000 | 200 | 80 |
| 255 | 11111111 | 377 | FF |
| 256 | 100000000 | 400 | 100 |
| 1024 | 10000000000 | 2000 | 400 |
FAQ
How do I convert decimal to hex?
Enter the number and its hex form appears instantly. By hand, divide by 16 repeatedly and read the remainders from last to first, writing 10–15 as A–F.
What is 255 in hex?
FF. 256 is 100, 1000 is 3E8 and 65,535 is FFFF.
How do I add a 0x prefix?
Turn on “Prefix” under Format to get 0xFF instead of FF.
How do I convert negative numbers to hex?
Choose 8, 16, 32 or 64-bit two’s complement under Negative numbers. −1 becomes FF, FFFF, FFFFFFFF or FFFFFFFFFFFFFFFF.