• Practice
  • About 14 min
  • 5 practice questions

Octal and hexadecimal systems

Convert among binary, octal and hexadecimal using grouping of bits.

If something looks wrong, please tell us.

Long binary numbers are hard to read, so computing uses shorter forms. Octal has base 8 with digits 0 to 7. Hexadecimal has base 16 with digits 0 to 9 and then A to F, where A is 10, B is 11, C is 12, D is 13, E is 14 and F is 15.

Grouping trick

  • Octal: group binary digits in threes from the right. Each group is one octal digit.
  • Hexadecimal: group binary digits in fours from the right. Each group is one hex digit.
Four-bit groups
BinaryDecimalHex
000000
100199
101010A
110012C
111115F

Worked examples

Example 1. Convert 101110 to octal. Groups of three: 101 and 110. 101 = 5 and 110 = 6, so the octal is 56. Check: 5 x 8 + 6 = 46, and 101110 = 32 + 8 + 4 + 2 = 46.

Example 2. Convert 11010110 to hexadecimal. Groups of four: 1101 and 0110. 1101 = 13 = D and 0110 = 6, so the hex is D6. Check: 13 x 16 + 6 = 214, and 128 + 64 + 16 + 4 + 2 = 214.

Example 3. Convert the hexadecimal 2F to decimal. 2 x 16 + 15 = 47.

Binary to octal: groups of 3. Binary to hex: groups of 4. In hex, A to F stand for 10 to 15.

— Rule to remember

Key takeaways: group bits in threes for octal and fours for hex, and remember A to F.

Check your understanding

  1. 1. What is hexadecimal E in decimal?

    1. 13
    2. 14
    3. 15
    4. 12
    Show answer

    Answer: B. A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

  2. 2. Convert decimal 255 to hexadecimal.

    1. F0
    2. EF
    3. FF
    4. 1FF
    Show answer

    Answer: C. 255 / 16 = 15 remainder 15, so F and F: FF. Check: 15 x 16 + 15 = 255.

  3. 3. Convert decimal 100 to octal.

    1. 124
    2. 64
    3. 410
    4. 144
    Show answer

    Answer: D. 100 / 8 = 12 r4, 12 / 8 = 1 r4, 1 / 8 = 0 r1. Upward: 144. Check: 64 + 32 + 4 = 100.

  4. 4. Convert binary 1110 0101 to hexadecimal.

    1. E5
    2. 5E
    3. D5
    4. E4
    Show answer

    Answer: A. 1110 = 14 = E and 0101 = 5, so E5. Check: 14 x 16 + 5 = 229 and 128 + 64 + 32 + 4 + 1 = 229.

  5. 5. Convert binary 111101 to octal.

    1. 57
    2. 75
    3. 61
    4. 175
    Show answer

    Answer: B. Groups of three: 111 = 7 and 101 = 5, so 75. Check: 7 x 8 + 5 = 61 and 32 + 16 + 8 + 4 + 1 = 61. (61 is the decimal value.)

Sign in to keep track of the lessons you finish.

Next lesson → Binary arithmetic and complements

Privacy · Terms · Refunds · Delivery