Octal to Binary and Hexadecimal Conversions
An octal number can be converted into binary or hexadecimal without repeatedly dividing the number. These conversions use the relationship between the bases: each octal digit corresponds to exactly 3 binary bits, while hexadecimal digits correspond to 4 binary bits.
This note explains how to convert octal numbers to binary and how to convert octal numbers to hexadecimal through binary.
1. Octal to Binary Conversion
The octal number system has base 8 and uses the digits 0 to 7. The binary number system has base 2 and uses only 0 and 1.
Since (8 = 2^3), each octal digit can be represented by a group of exactly 3 binary digits (bits). Therefore, converting an octal number to binary is a matter of replacing each octal digit with its 3-bit binary equivalent.
Method
- Take each octal digit separately.
- Replace each digit with its 3-bit binary equivalent.
- Write the binary groups in the same order as the original octal digits.
- Join the groups to form the binary number.
Octal-to-binary reference table
| Octal digit | 3-bit binary |
|---|---|
| 0 | 000 |
| 1 | 001 |
| 2 | 010 |
| 3 | 011 |
| 4 | 100 |
| 5 | 101 |
| 6 | 110 |
| 7 | 111 |
Every group must contain three bits. Add leading zeros when necessary. For example, octal digit 3 is written as 011, not just 11, because the conversion uses 3-bit groups.
Replace each octal digit with its 3-bit equivalent:
| Octal digit | 5 | 7 |
|---|---|---|
| 3-bit binary | 101 | 111 |
Join the groups in the same order:
[ 57_8 = 101111_2 ]
Example 2: Convert (306_8) to binaryConvert each digit separately. The zero must also be represented by three bits.
| Octal digit | 3 | 0 | 6 |
|---|---|---|---|
| 3-bit binary | 011 | 000 | 110 |
Join the groups:
[ 306_8 = 011000110_2 ]
The leading zero may be removed when writing the final binary value, so (11000110_2) represents the same value. Keeping the leading zero is useful here because it shows the original 3-bit grouping.
2. Octal to Hexadecimal Conversion
The hexadecimal number system has base 16. It uses the digits 0 to 9 and the letters A to F, where A represents 10, B represents 11, C represents 12, D represents 13, E represents 14, and F represents 15.
There is no single fixed-width digit replacement from octal to hexadecimal. Instead, convert the octal number to binary first, then group the binary digits into sets of four from the right. Each 4-bit group corresponds to one hexadecimal digit.
Method
- Convert every octal digit into its 3-bit binary equivalent.
- Join the binary groups in the original order.
- Starting from the right, divide the binary digits into groups of 4.
- If the leftmost group has fewer than 4 bits, add leading zeros to complete it.
- Convert each 4-bit group to its hexadecimal equivalent.
- Write the hexadecimal digits from left to right.
4-bit binary-to-hexadecimal reference table
| Binary | Hexadecimal | Binary | Hexadecimal |
|---|---|---|---|
| 0000 | 0 | 1000 | 8 |
| 0001 | 1 | 1001 | 9 |
| 0010 | 2 | 1010 | A |
| 0011 | 3 | 1011 | B |
| 0100 | 4 | 1100 | C |
| 0101 | 5 | 1101 | D |
| 0110 | 6 | 1110 | E |
| 0111 | 7 | 1111 | F |
Example 1: Convert (57_8) to hexadecimal
Step 1: Convert octal to binary.
[ 5_8 = 101_2,\qquad 7_8 = 111_2 ]
Therefore:
[ 57_8 = 101111_2 ]
Step 2: Group the binary digits into sets of four from the right.
[ 101111_2 \rightarrow 0010\ 1111_2 ]
Two leading zeros are added to complete the leftmost 4-bit group. These zeros do not change the value.
Step 3: Convert each group to hexadecimal.
| 4-bit binary group | Hexadecimal digit |
|---|---|
| 0010 | 2 |
| 1111 | F |
Read the hexadecimal digits from left to right:
[ 57_8 = 2F_{16} ]
Example 2: Convert (306_8) to hexadecimalStep 1: Convert octal to binary.
[ 3_8 = 011_2,\qquad 0_8 = 000_2,\qquad 6_8 = 110_2 ]
[ 306_8 = 011000110_2 ]
Step 2: Group into 4-bit sets from the right.
[ 011000110_2 \rightarrow 0001\ 1000\ 0110_2 ]
The leftmost group is completed with leading zeros. The groups are 0001, 1000, and 0110.
Step 3: Convert each group to hexadecimal.
| 4-bit binary group | Hexadecimal digit |
|---|---|
| 0001 | 1 |
| 1000 | 8 |
| 0110 | 6 |
Therefore:
[ 306_8 = 186_{16} ]
3. Why the Conversion Uses Binary
Octal and binary are closely related because the octal base is a power of two:
[ 8 = 2^3 ]
That is why one octal digit always maps to three binary bits.
Hexadecimal is also a power-of-two number system:
[ 16 = 2^4 ]
Therefore, one hexadecimal digit maps to four binary bits. When converting octal to hexadecimal, binary provides a convenient intermediate representation:
The grouping for hexadecimal must start at the right-hand side because the rightmost digit represents the least significant part of the number. Adding zeros to the left completes the group without changing the number's value.
4. Important Points for Examinations
- Each octal digit is replaced by exactly 3 binary bits.
- Keep the original order of the octal digits when converting to binary.
- To convert octal to hexadecimal, convert to binary first.
- Group binary digits into 4-bit groups from the right for hexadecimal conversion.
- Add leading zeros to complete a group; do not add zeros to the right.
- Use
AtoFfor hexadecimal values 10 to 15. - The number's value stays the same; only its representation changes.
Key Idea: Octal to binary uses 3-bit replacement. Octal to hexadecimal uses 3-bit replacement followed by 4-bit grouping from the right.
5. Quick Practice
Convert each octal number as requested.
- (110_8) to binary
- (72_8) to binary
- (346_8) to hexadecimal
- (1F_{16}) is not an octal value; check that the given number uses only digits
0to7before beginning an octal conversion.
Answers
- (110_8 = 001\ 001\ 000_2), or (1001000_2) without the leading zeros.
- (72_8 = 111\ 010_2 = 111010_2).
- (346_8 = 011\ 100\ 110_2 = 0111\ 0011\ 0_2). Grouping correctly from the right gives (0001\ 1100\ 1110_2 = 1CE_{16}).
Summary
To convert an octal number to binary, replace every octal digit with its 3-bit binary equivalent and join the groups in the same order. To convert octal to hexadecimal, first perform that octal-to-binary conversion, then group the bits into sets of four from the right and convert each group to a hexadecimal digit. Leading zeros may be added on the left to complete a group, but the value of the number does not change.