Instant conversion
Decimal to Hex Converter
Hex value is found by repeatedly dividing the decimal integer by 16 and writing the remainders as 0-9 or A-F.
Common decimal to hex conversions
| decimal | hex |
|---|---|
| 1 | 1 |
| 10 | A |
| 15 | F |
| 16 | 10 |
| 31 | 1F |
| 42 | 2A |
| 64 | 40 |
| 127 | 7F |
| 128 | 80 |
| 255 | FF |
| 256 | 100 |
| 1000 | 3E8 |
How this conversion works
Hex value is found by repeatedly dividing the decimal integer by 16 and writing the remainders as 0-9 or A-F.
Privacy: Conversions run in this browser. Nothing you type is uploaded.
What you are converting
Decimal
Base-10 number system using digits 0 through 9, the standard way people count and record everyday quantities such as prices ($19.99), ages, and distances (a 5 km jog).
Hexadecimal
Base-16 number system using digits 0-9 and letters A-F, commonly seen in web color codes like #FF5733, memory addresses, and MAC addresses printed on network hardware.
Why convert and when you would use this
Web developers convert decimal RGB values into hex to write compact CSS color codes such as #1A73E8 instead of rgb(26, 115, 232). Embedded programmers also rely on hex to read memory dumps, set register bit flags, and compare byte values shown in debuggers and hex file editors.
Worked example
Convert 2024 to hex: 2024 divided by 16 gives quotient 126 remainder 8; 126 divided by 16 gives quotient 7 remainder 14 (E); 7 divided by 16 gives quotient 0 remainder 7. Reading remainders bottom-up, 2024 decimal equals 7E8 hexadecimal. Verify: 7 x 256 + 14 x 16 + 8 = 1792 + 224 + 8 = 2024.
Rounding and accuracy
Hexadecimal represents whole integers exactly, so no rounding is needed for integer input. For fractional decimals, carry the conversion to at least six hexadecimal places after the radix point and stop there; truncate rather than round unless your application specifies otherwise, since repeated division rarely terminates for fractions.
Frequently asked questions
How do you convert decimal to hex?
Repeatedly divide the decimal number by 16 and read the remainders as hex digits.
What does A mean in hex?
A represents decimal 10; B through F represent 11 through 15.
Does decimal to hex change the number's value?
No. It only changes the base used to write the same integer value.