Converting a decimal number straight to hexadecimal is tedious. Going through octal is much faster: divide by 8 first, then write every octal digit as three binary digits, group those in fours and read them as hexadecimal. Every step is mechanical, because 8 and 16 are powers of two - that is exactly why binary works here as a common language. The same route travelled backwards turns a hexadecimal number into a decimal one.
Using octal numbers as an intermediate step
a) convert to the octal system
| remainder | ||
| 348 | : 8 | 4 |
| 43 | : 8 | 3 |
| 5 | : 8 | 5 |
| 0 | ↑ |
| 0.654 | · 8 | |
| 5 | .232 | · 8 |
| 1 | .856 | · 8 |
| 6 | .848 | · 8 |
| 6 | .784 |
The fourth digit decides how the third is rounded: 6 is more than half of eight, so 0.5166 is written as 0.517.
b) write the binary equivalent of each digit in groups of three binary digits
Place values - see Part 10 of this course.
c) group the binary digits into groups of four, moving away from the decimal point in both directions
Add zeros so that there are four digits in every group.
d) write the hexadecimal equivalent of each group of four binary digits
Convert to octal, binary and hexadecimal form
| remainder | ||
| 428 | : 8 | 4 |
| 53 | : 8 | 5 |
| 6 | : 8 | 6 |
| 0 | ↑ |
| 0.371 | · 8 | |
| 2 | .968 | · 8 |
| 7 | .744 | · 8 |
| 5 | .952 | · 8 |
| 7 | .616 |
| remainder | ||
| 163 | : 8 | 3 |
| 20 | : 8 | 4 |
| 2 | : 8 | 2 |
| 0 | ↑ |
| 0.245 | · 8 | |
| 1 | .960 | · 8 |
| 7 | .680 | · 8 |
| 5 | .440 |
Convert to binary, octal and decimal form - the reverse method
A = 10, B = 11
Integer part
Fractional part
correct to three decimal places
D = 13, E = 14
Integer part
Fractional part
correct to three decimal places
Frequently asked questions
Why go through octal instead of straight to hexadecimal?
Because dividing and multiplying by 8 can be done in your head, which is not always true for 16. The octal form then turns into binary one digit at a time, so the hard part disappears.
How many binary digits does one octal digit correspond to?
Exactly three, because 8 is 2³ - each of the eight values fits into three binary digits. For hexadecimal it is four digits, because 16 is 2⁴.
From which side do you group the binary digits?
Always from the point: the integer part to the left, the fractional part to the right. Fill in the outermost group with zeros - that does not change the value of the number.
How do you get back from hexadecimal to decimal?
Write every hexadecimal digit as four binary digits, regroup them in threes and read off the octal number, then convert that to decimal with the method from Part 11.