Decimal to Hexadecimal Conversion
How do you convert decimal to hexadecimal?
Method 1 (decimal to binary to hexadecimal)
- To convert the decimal number 28 to hexadecimal, start by converting the decimal number to binary
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
- Split the 8 bit binary number into two 4 bit numbers (nibbles) as shown below
8 | 4 | 2 | 1 | 8 | 4 | 2 | 1 | |
0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
- Convert each nibble to its decimal value
- 0001 = 1 and 1100 = 12
- Using the comparison table, the decimal value 1 is also 1 in hexadecimal whereas the decimal value 12 is represented in hexadecimal as C
- decimal 28 is 1C in hexadecimal
Method 2 (divide by 16)
- To convert the decimal number 163 to hexadecimal, start by dividing the decimal value by 16 and recording the whole times the number goes in and the remainder
- 163 ➗16 = 10 remainder 3
- In hexadecimal the whole number = digit 1 and the remainder = digit 2
- Digit 1 = 10 (A)
- Digit 2 = 3
- Decimal 163 is A3 in hexadecimal