Decimal to Hex Converter
Enter a base-10 decimal number (integer or fraction), then convert it instantly to base-16 hexadecimal.
What this convert decimal to hex calculator does
This tool converts decimal numbers (base 10) into hexadecimal numbers (base 16). It supports
positive and negative values and can also convert decimal fractions such as 10.625 into hexadecimal form.
You can choose uppercase letters (A-F) and whether to include the 0x prefix.
How to use it
- Type a decimal value in the input box (for example:
1024or-19.5). - Select how many hexadecimal digits you want after the decimal point.
- Choose formatting options (uppercase and/or
0xprefix). - Click Convert to get the result.
Decimal vs. hexadecimal: quick refresher
Decimal uses ten symbols: 0-9. Hexadecimal uses sixteen symbols:
0-9 and A-F. Because hexadecimal maps neatly to binary, it is heavily used in computing,
memory addresses, color codes, machine data, and debugging tools.
Example
Decimal 255 equals hexadecimal FF (or 0xFF).
Decimal 4095 equals hexadecimal FFF.
How manual conversion works
For whole numbers
Repeatedly divide the decimal number by 16 and record each remainder. Read the remainders from bottom to top.
Example for 756:
- 756 ÷ 16 = 47 remainder 4
- 47 ÷ 16 = 2 remainder 15 (F)
- 2 ÷ 16 = 0 remainder 2
Reading remainders upward gives 2F4.
For decimal fractions
Multiply the fractional part by 16 repeatedly. Each integer part you get becomes the next hex digit. Continue until the fraction becomes zero or you reach your chosen precision.
Common decimal to hex values
| Decimal | Hexadecimal |
|---|---|
| 10 | A |
| 15 | F |
| 16 | 10 |
| 31 | 1F |
| 64 | 40 |
| 127 | 7F |
| 255 | FF |
| 1024 | 400 |
Where decimal-to-hex conversion is useful
- Programming and software debugging
- Web design color codes (e.g.,
#1E73BE) - Embedded systems and microcontrollers
- Network protocols and packet analysis
- Reading memory dumps and binary files
FAQ
Does this support negative numbers?
Yes. Example: -42 becomes -0x2A with prefix enabled.
Can it convert decimal fractions?
Yes. Set your desired precision. Some fractions produce repeating hexadecimal digits, so the calculator may stop at your precision limit.
Why might a fractional result look rounded?
Fractions in base 10 do not always have exact finite representations in base 16 (and vice versa). The calculator provides a practical precision-based output.