- Foundation
- About 13 min
- 5 practice questions
Octal and hexadecimal
Convert octal and hexadecimal numbers to decimal and binary using grouping of bits.
If something looks wrong, please tell us.
Long binary numbers are hard to read. Octal and hexadecimal shorten them, and conversion between them and binary is just grouping.
Grouping rule
- Octal: group binary digits in threes from the right (one octal digit = 3 bits).
- Hexadecimal: group binary digits in fours from the right (one hex digit = 4 bits).
| Decimal | 10 | 11 | 12 | 13 | 14 | 15 |
|---|---|---|---|---|---|---|
| Hex | A | B | C | D | E | F |
Worked examples
Example 1. Binary 101110 to octal. Groups of three: 101 and 110, which are 5 and 6, so 56 in octal. Check: 5 x 8 + 6 = 46, and 101110 = 32 + 8 + 4 + 2 = 46.
Example 2. Binary 11010110 to hexadecimal. Groups of four: 1101 = D and 0110 = 6, so D6. Check: 13 x 16 + 6 = 214, and the binary = 128 + 64 + 16 + 4 + 2 = 214.
Example 3. Hexadecimal 2F to decimal. 2 x 16 + 15 = 47.
Example 4. Octal 157 to decimal. 1 x 64 + 5 x 8 + 7 = 64 + 40 + 7 = 111.
Example 5. Decimal 175 to hexadecimal. 175 / 16 = 10 remainder 15, so A then F: AF. Check: 10 x 16 + 15 = 175.
Example 6. Decimal 100 to octal. 100 / 8 = 12 r4; 12 / 8 = 1 r4; 1 / 8 = 0 r1. Reading upward: 144. Check: 64 + 32 + 4 = 100.
Octal = 3 bits per digit. Hex = 4 bits per digit. A=10 to F=15.
Key takeaways
- Group bits in 3s for octal and 4s for hex.
- Hex letters A to F stand for 10 to 15.
- Check conversions by turning them back into decimal.
Check your understanding
-
1. Convert binary 110011 to octal.
- 36
- 33
- 63
- 51
Show answer
Answer: C. Groups of three from the right: 110 and 011, which are 6 and 3, so 63. Check: 6 x 8 + 3 = 51 and 32 + 16 + 2 + 1 = 51.
-
2. Convert binary 10111010 to hexadecimal.
- AB
- B9
- 272
- BA
Show answer
Answer: D. Groups of four: 1011 = 11 = B and 1010 = 10 = A, so BA. Check: 11 x 16 + 10 = 186 and 128 + 32 + 16 + 8 + 2 = 186.
-
3. Convert hexadecimal 3C to decimal.
- 60
- 48
- 312
- 63
Show answer
Answer: A. C = 12, so 3 x 16 + 12 = 48 + 12 = 60.
-
4. Convert octal 64 to decimal.
- 64
- 52
- 48
- 100
Show answer
Answer: B. 6 x 8 + 4 = 48 + 4 = 52.
-
5. Convert decimal 200 to hexadecimal.
- 8C
- 128
- C8
- C4
Show answer
Answer: C. 200 / 16 = 12 remainder 8, and 12 is C, so C8. Check: 12 x 16 + 8 = 192 + 8 = 200.
Sign in to keep track of the lessons you finish.