Decimal to Hexadecimal Converter
Enter a whole decimal number and see the hexadecimal equivalent instantly — plus binary, octal and byte size for context.
How does this calculator work?
Divide the decimal by 16 repeatedly, collecting remainders (10→A … 15→F) in reverse order. Example: 255 ÷ 16 = 15 r 15, 15 ÷ 16 = 0 r 15 → remainders reversed: FF → 0xFF. Or convert to binary first, then group into nibbles and replace each with its hex digit. Uses BigInt for arbitrary precision.
Formula
How this is calculated
To convert a decimal integer to hexadecimal, repeatedly divide by 16 and record each remainder as a hex digit. Remainders 0–9 stay as digits; 10–15 become A–F. Collect the remainders in reverse order. For 255: 255 ÷ 16 = 15 r 15, then 15 ÷ 16 = 0 r 15. Remainders bottom-up: 15, 15 → F, F → 0xFF.
The equally fast shortcut is to convert decimal to binary first (or use binary as the intermediate), then group the binary bits into nibbles (4-bit groups) from the right and swap each nibble for the corresponding hex digit. This makes the structural relationship between hex and binary clear — one hex digit always equals exactly four binary bits.
This calculator uses JavaScript BigInt, so arbitrarily large integers (beyond the 53-bit safe integer limit of regular floating-point) are converted exactly. Binary and octal are also shown to complete the picture. The byte count shows how many 8-bit bytes are needed to store the value.
Frequently asked questions
255 in binary is 11111111. Group into two nibbles: 1111 and 1111, each equal to 15 = F. So 255 = 0xFF. Alternatively: 255 ÷ 16 = 15 remainder 15 → FF.
Hexadecimal needs 16 symbols for digits 0–15. The letters A through F represent values 10 through 15 respectively. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.
Hex is four times more compact than binary (8 bits = two hex digits instead of eight binary digits) and maps cleanly back to bits because 2⁴ = 16. It appears in colour codes (#FF5733), memory addresses (0x7FFF), machine code, cryptographic hashes and network addresses.
Also known as
TG we-Calculate Editorial Team. (2026). Decimal to Hexadecimal Converter [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/decimal-to-hexadecimal-calculator
TG we-Calculate Editorial Team. "Decimal to Hexadecimal Converter." TG we-Calculate. 2026. https://we-calculate.com/calculator/decimal-to-hexadecimal-calculator.
TG we-Calculate Editorial Team, "Decimal to Hexadecimal Converter," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/decimal-to-hexadecimal-calculator
@misc{wecalculate_decimal_to_hexadecimal_calculator, title = {Decimal to Hexadecimal Converter}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/decimal-to-hexadecimal-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
