Decimal to Hexadecimal Calculator
Enter a decimal value (integer or fraction) and instantly convert it to base-16 hexadecimal notation.
Tip: Press Enter in the number field to convert quickly.
What this decimal to hexadecimal calculator does
This tool converts base-10 (decimal) numbers into base-16 (hexadecimal) format. It supports positive numbers, negative numbers, and decimal fractions. For fractions, you can choose how many hexadecimal digits to generate after the point.
Understanding decimal vs hexadecimal
Decimal (Base 10)
Decimal uses ten symbols: 0 through 9. Each place value is a power of 10.
For example, 347 means 3×10² + 4×10¹ + 7×10⁰.
Hexadecimal (Base 16)
Hexadecimal uses sixteen symbols: 0-9 and A-F (or a-f), where:
A = 10B = 11C = 12D = 13E = 14F = 15
Each place value is a power of 16, which makes hexadecimal compact and ideal for computing tasks.
How the conversion works
For integer values
Repeatedly divide the decimal number by 16, recording remainders each time. Read the remainders from bottom to top to get the hexadecimal result.
For fractional values
Repeatedly multiply the fractional part by 16. The integer part of each multiplication becomes the next hex digit. Continue until the fraction becomes 0 or until you reach your chosen precision.
Examples
- 255 in decimal = 0xFF
- 26 in decimal = 0x1A
- 10.625 in decimal = 0xA.A
- -42 in decimal = -0x2A
Why developers use hexadecimal
- Maps cleanly to binary (1 hex digit = 4 binary bits).
- Shorter and easier to read than long binary strings.
- Common in memory addresses, machine code, and debugging.
- Used in web colors like
#FF5733.
Common mistakes to avoid
- Forgetting that
A-Frepresent values 10-15. - Reading integer conversion remainders in the wrong order.
- Rounding fractional output too aggressively.
- Confusing decimal points with hexadecimal points.
Quick FAQ
Can this calculator handle very large integers?
Yes. It uses JavaScript BigInt for the integer portion, so you can convert very large whole numbers without losing precision.
Why do some fractional conversions repeat?
Just like repeating decimals in base-10, some decimal fractions do not terminate in base-16. The calculator marks repeating cycles with parentheses.
Should I use uppercase or lowercase hex digits?
Both are valid. Many technical documents use uppercase for readability, while some coding styles prefer lowercase.