ITKokka
Lesson 3 ยท Note 7

Number System Conversions (Binary - Octal & Hexadecimal)

๐Ÿ“Œ The Short Note

Download

๐Ÿ“– Explanation

Number System Conversions: Binary to Octal and Hexadecimal

Binary numbers are used internally by digital computers, but long binary numbers can be difficult for people to read and remember. Octal and hexadecimal provide shorter ways to represent binary values. Since their bases are powers of two, binary numbers can be converted to these systems by grouping bits.

This short note explains how to convert binary numbers into octal and hexadecimal, how to use bit groups, and how to check the result.

Number systems and their bases

A number system is a way of representing numbers using a set of digits or symbols and a base (also called a radix). The base determines how many different digit values are available.

Number systemBaseDigits or symbols
Binary20, 1
Octal80โ€“7
Decimal100โ€“9
Hexadecimal160โ€“9 and Aโ€“F

In hexadecimal, the letters A to F represent the values 10 to 15.

Hexadecimal digitDecimal value
A10
B11
C12
D13
E14
F15

Why binary can be converted directly

Octal and hexadecimal are closely related to binary because:

  • (8 = 2^3), so one octal digit represents exactly three binary bits.
  • (16 = 2^4), so one hexadecimal digit represents exactly four binary bits.

This relationship makes conversion straightforward. Instead of converting the binary number to decimal first, divide the binary digits into groups and replace each group with its corresponding octal or hexadecimal digit.

Key Idea: Group binary digits from the right-hand side. Use groups of 3 bits for octal and groups of 4 bits for hexadecimal.

Binary to octal conversion

To convert a binary number to octal:

  1. Start at the rightmost bit and divide the binary number into groups of three bits.
  2. If the leftmost group has fewer than three bits, add leading zeros to complete it.
  3. Convert each 3-bit group into its octal value.
  4. Write the octal digits in the same order as the groups, from left to right.

The added zeros are placed at the beginning of the number, so they do not change its value.

3-bit binary to octal reference

Binary groupOctal digit
0000
0011
0102
0113
1004
1015
1106
1117

Each possible 3-bit group corresponds to one octal digit.

Example 1: Convert 1101011โ‚‚ to octal

Step 1: Group the bits from the right.

The binary number has seven bits. Make groups of three, starting from the right. Add a leading zero to complete the first group.

1101011โ‚‚
001 101 011

Step 2: Convert each group.

  • 001 represents 1.
  • 101 represents 5.
  • 011 represents 3.

Step 3: Write the octal digits in order.

001  101  011
 1    5    3

Therefore:

[ 1101011_2 = 153_8 ]

Example 2: Convert 101001โ‚‚ to octal

Group the bits into sets of three from the right:

101 001

Convert each group using the reference table:

  • 101 = 5
  • 001 = 1

Therefore:

[ 101001_2 = 51_8 ]

Binary to hexadecimal conversion

To convert a binary number to hexadecimal, use a similar method, but make groups of four bits.

  1. Start from the rightmost bit and divide the binary number into groups of four.
  2. Add leading zeros to the leftmost group if it contains fewer than four bits.
  3. Convert each 4-bit group into its hexadecimal digit.
  4. Write the hexadecimal digits in the same order as the groups.

A hexadecimal digit can represent any value from 0 to 15. Values 10 to 15 are written using A, B, C, D, E, and F.

4-bit binary to hexadecimal reference

Binary groupHexadecimal digit
00000
00011
00102
00113
01004
01015
01106
01117
10008
10019
1010A
1011B
1100C
1101D
1110E
1111F
Example 1: Convert 11011110โ‚‚ to hexadecimal

Step 1: Group the bits from the right into sets of four.

1101 1110

Step 2: Convert each group.

  • 1101 represents 13, which is D in hexadecimal.
  • 1110 represents 14, which is E in hexadecimal.

Step 3: Write the hexadecimal digits in order.

Therefore:

[ 11011110_2 = DE_{16} ]

Example 2: Convert 10101โ‚‚ to hexadecimal

The number has five bits. Group from the right and add leading zeros to complete the leftmost group:

0001 0101

Convert the groups:

  • 0001 = 1
  • 0101 = 5

Therefore:

[ 10101_2 = 15_{16} ]

Understanding the grouping method

The grouping method works because each group represents one digit in the target number system.

For octal, a group of three bits has a value from 0 to 7. For hexadecimal, a group of four bits has a value from 0 to 15. These are exactly the digit ranges used by the respective number systems.

When converting, do not reverse the groups. Read the converted digits from left to right in the same order as the binary groups.

Quick comparison

ConversionGroup sizeTarget digit range
Binary to octal3 bits0โ€“7
Binary to hexadecimal4 bits0โ€“9, Aโ€“F

Common mistakes to avoid

  • Grouping from the wrong side: Always begin grouping at the rightmost bit.
  • Using the wrong group size: Use 3 bits for octal and 4 bits for hexadecimal.
  • Forgetting leading zeros: Complete the leftmost group when necessary. Only add zeros to the left, not to the right.
  • Reversing the result: Keep the converted digits in the same left-to-right order as their groups.
  • Writing hexadecimal values incorrectly: Remember that A = 10, B = 11, C = 12, D = 13, E = 14, and F = 15.

Exam-focused points

Key Idea: Binary-to-octal conversion uses groups of 3 bits because (8=2^3).

Key Idea: Binary-to-hexadecimal conversion uses groups of 4 bits because (16=2^4).

Key Idea: If the leftmost group is incomplete, add leading zeros. These zeros do not change the value of the binary number.

Quick practice

Try converting each binary number without using a decimal conversion step.

Binary numberConvert to
(110_2)Octal
(11001_2)Octal
(111001_2)Octal
(1010_2)Hexadecimal
(11011110_2)Hexadecimal
(10101_2)Hexadecimal

Answers

Binary numberResult
(110_2)(6_8)
(11001_2)(31_8)
(111001_2)(71_8)
(1010_2)(A_{16})
(11011110_2)(DE_{16})
(10101_2)(15_{16})

Summary

Binary numbers can be converted directly into octal and hexadecimal by grouping bits. For octal, make groups of three bits; for hexadecimal, make groups of four bits. In both cases, start from the right, add leading zeros if needed, convert each group using the corresponding values, and write the results in order. The number's value stays the same; only its representation changes.

Share:
โ† Number System conversions (Other Number Systems - Decimal )Number System Conversions (Octal - Binary & Hexadecimal) โ†’