Decimal to Hexadecimal Converter
Convert decimal numbers to hexadecimal format
Tip: Enter a decimal number (0-9 only). The conversion happens in real-time.
Runs in your browserDecimal Hex
Decimal to hex, step by step
Convert decimal to hexadecimal
Type a decimal number and its hex form appears as you type, in capital letters. Once it is longer than four digits it is also split into pairs, so every pair is one byte, and the window bar shows how many bits the number takes.
This hex converter is exact for whole numbers of any size: 18446744073709551615 becomes FFFFFFFFFFFFFFFF. Commas, spaces and underscores in the input are skipped, so you can paste 1,000,000 as it is and get F4240.
How to convert decimal to hex by hand
Divide by 16 and keep the remainder, a number from 0 to 15, writing 10 to 15 as A to F. Repeat with the quotient until it is 0, then read the remainders from the last to the first. For 48879:
| Step | Remainder | Hex digit |
|---|---|---|
| 48879 ÷ 16 = 3054 | 15 | F |
| 3054 ÷ 16 = 190 | 14 | E |
| 190 ÷ 16 = 11 | 14 | E |
| 11 ÷ 16 = 0 | 11 | B |
Read upwards: 48879 is BEEF in hex. To check it, multiply back: 11 × 4096 + 14 × 256 + 14 × 16 + 15 = 48879. The step-by-step window above runs the same divisions on your own number.
Decimal and hex values worth knowing
| Decimal | Hex |
|---|---|
| 10 | A |
| 15 | F |
| 16 | 10 |
| 32 | 20 |
| 100 | 64 |
| 127 | 7F |
| 128 | 80 |
| 255 | FF |
| 256 | 100 |
| 1000 | 3E8 |
| 4096 | 1000 |
| 65535 | FFFF |
| 16777215 | FFFFFF |
Every two hex digits are one byte, so the largest byte, 255, is FF. Color codes work the same way: #FF8800 is red 255, green 136 and blue 0, and the RGB to hex converter builds such a code from three decimal values.
Need the decimal value of a hex number?
The hex to decimal converter multiplies each digit by its power of 16 and shows the sum.
Negative numbers and fixed-width hex
What the result looks like
-255becomes-FF: the sign is written, and the digits are the size of the number- Capital letters and no
0xprefix:255isFF - The shortest form:
15isF, not0F
Not converted
- Two's complement: as a 32-bit value
-1isFFFFFFFF, which this converter does not write - Padding to a width such as
00FF: add the zeros yourself - Fractions:
0.5is shown as an error, since only whole numbers are converted
To see binary and octal next to the hex, use the number system converter; for the bits alone, the decimal to binary converter.
Decimal to hex questions
FF. 255 ÷ 16 = 15 remainder 15, and 15 is F, so both digits are F.
Base 16 needs sixteen digits and only ten exist, so A to F stand for 10 to 15.
Put 0x in front: 255 becomes 0xFF in C, JavaScript, Python and most other languages. The converter shows the digits without the prefix.
Yes. The arithmetic is exact for whole numbers of any length, so every hex digit of a 25-digit number is right. The step-by-step window lists up to 40 divisions.
No. The conversion runs in your browser.