Complete Guide to Decimal to Hexadecimal Conversion
The decimal (base 10 / denary) system is the standard numbering system used in everyday human counting, utilizing the ten digits 0 through 9. The hexadecimal (base 16) system is widely employed in computer science, software development, memory addressing, color representation (CSS hex codes), and digital electronics because each hexadecimal digit neatly represents exactly 4 binary bits (a nibble).
How to Convert Decimal to Hexadecimal (Division by 16 Method)
The standard manual algorithm to convert any positive integer from base 10 to base 16 is successive integer division by 16:
- Divide the decimal number by 16 to find the integer quotient and the remainder.
- Write down the remainder. If the remainder is between 10 and 15, substitute the appropriate hexadecimal letter:
- 10 = A
- 11 = B
- 12 = C
- 13 = D
- 14 = E
- 15 = F
- Replace the original number with the integer quotient.
- Repeat steps 1 through 3 until the quotient becomes zero.
- Read the hex digits from bottom to top (most significant digit to least significant digit).
• 7562 ÷ 16 = 472 remainder 10 → A
• 472 ÷ 16 = 29 remainder 8
• 29 ÷ 16 = 1 remainder 13 → D
• 1 ÷ 16 = 0 remainder 1
Reading remainders in reverse order: 1D8A₁₆
How to Convert Hexadecimal Back to Decimal (Powers of 16)
To go from hexadecimal to decimal, multiply each hexadecimal digit by 16 raised to the power of its position index (starting at 0 for the rightmost digit):
Example: Convert 1D8A₁₆ to decimal:
• (1 × 16³) = 1 × 4096 = 4096
• (D × 16²) = 13 × 256 = 3328
• (8 × 16¹) = 8 × 16 = 128
• (A × 16&sup0;) = 10 × 1 = 10
Sum = 4096 + 3328 + 128 + 10 = 7562₁₀