Hexadecimal to Octal Conversion with Examples
This post is all about the conversion of hexadecimal to octal. That is, through this article, you will learn the method that is used to convert a number from the hexadecimal number system to the octal number system. But before we begin, let's define these two numbers first.
- Hexadecimal number: The hexadecimal number system has a base of 16, therefore it allows 16 digits that can be used to create or form a
hexadecimal number. For example: 25D, 4A3, and FA, etc.
In other words, a number that consists of 16 digits, which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F, is considered to be a hexadecimal number. The characters A-F refer to 10–15. That is, A refers to 10, B refers to 11, and so on.
- Octal number: On the other hand, the octal number system has a base of 8, which means it allows eight digits, which are 0, 1, 2, 3, 4, 5, 6, and 7. For example, 437, 32, and 506, etc. are some examples of octal numbers.
Hexadecimal to Octal Conversion Steps with an Example
Follow the steps below to convert a number written in hexadecimal to an octal representation. Let's pretend that the value 4CA is what we have to work with in the hexadecimal number system:
- Write the binary equivalent of each and every hex digit in a 4-bit binary pair.
- That is, the binary equivalent of 4CA is 0100 1100 1010
- Combine these 4-bit binary numbers.
- So it will be 010011001010.
- Now split the above binary number into 3-3 pairs, starting from the LSB side.
- As a result, it will be 010 011 001 010.
- Convert each 3-bit group into its equivalent octal digit.
- So it will be 2 3 1 2.
- Combine these octal digits.
- So it will be 2312.
- Therefore, (4CA)16 = (2312)8.
Hexadecimal to Octal Example
Let's take an example to apply all the above rules and understand them in a clear way by converting a hexadecimal number to octal.
(4CA)16 = ( ? )8
Therefore, we have a number in the hexadecimal system, which is 4CA. We have to split that number and convert it into a 4-bit binary equivalent, as shown in the table given below:
|Hex Digit||4-bit Binary Equivalent|
Therefore, we have a total of three pairs of 4-bit binary numbers, that is, 0100, 1100, and 1010. Now combine all three pairs, and we get 010011001010. Now we have to make or split it into 3–3 pairs. Then we get 010, 011, 001, and 010. Convert these four 3-bit binary numbers into their octal equivalents, as shown in the figure below:
Combining all four octal equivalents from the above figure yields 2312. Therefore, finally, (4CA)16 = (2312)8.
Programs Created on Hexadecimal to Octal Conversion
- Hexadecimal to Octal in C
- Hexadecimal to Octal in C++
- Hexadecimal to Octal in Java
- Hexadecimal to Octal in Python
« Previous Tutorial Next Tutorial »
Follow/Like Us on Facebook
Subscribe Us on YouTube