When eight bits are the same as a single byte, counting in octal becomes a bit easier. In this video, you’ll learn how to convert decimal to octal and octal to decimal.
<< Previous: Hexadecimal MathNext: CSMA/CD and CSMA/CA >>
The octal numbering system is a base 8 system that uses the numbers 0 through 7. And it’s a great numbering system for computers, since there are 8 bits in a byte. It’s common to see octal being used on many different operating systems. One common place to see it is in Unix or Linux. When you look at file permissions, those are calculated in octal.
It’s very easy to convert back and forth between decimal and octal. We’ll start by creating a conversion chart. So in our conversion chart, we’ll have four places. And at the top of the chart, we’ll put a 1.
We’ll multiply 1 times 8 to get 8, multiply 8 times 8 to get 64, and 64 times 8 to get 512. Another way to look at this would be 8 to the 0 power, to the first power, to the second power, and to the third power. Now that we have our conversion chart, let’s put it to use.
And our first question is, what is the decimal value of 27 octal? Well, here’s our conversion chart. And we’ll add 27 into those places. And now we perform some simple multiplication.
8 times 2 is 16 1 times 7 is 7. If we add all of those numbers up, we get 23. So the decimal value of 27 octal is 23 decimal.
Let’s do another octal to decimal conversion. In this case, we will convert 233 octal into decimal. So again, we have our conversion chart. We’ll put into it the 233. And now we’ll perform our multiplication of 64 times 2 is 128.
8 times 3 is 24. 1 times 3 is 3. We’ll add all of those up, and we find that the decimal value of 233 octal is 155 decimal.
Now let’s perform the reverse, where we have a decimal number, and we want to convert that to octal. We’ll take, in this case, the octal value of 122 decimal. What we want to find is the place in our conversion chart that’s farthest to the left where 122 is greater than the number that’s in our conversion chart.
So if we start at the left, 122 is not greater than 512, but 122 is greater than 64. So we’ll start there with our conversion. We’re going to perform a division– 122 divided by 64 goes one time, with a remainder of 58. And we’ll put the remainder in the next column to the right.
58 divided by 8 goes 7 times, with a remainder of 2. And 2 divided by 1 is 2. So our answer here, the octal value of 122 decimal is 172 octal.
Let’s do another conversion. We’ll take 200 decimal. We’ll convert it to octal. We’ll start by putting 200 in our conversion chart, again, all the way to the left. And the number needs to be greater than the number in our conversion chart.
200 is not greater than 512, so it’s not going to go in that column. 200 is greater than 64, so we’ll start there. 200 divided by 64 is 3, with a remainder of 8. 8 divided by 8 is obviously 1.
And since there’s no remainder, we put a 0 in the next column. 0 divided by 1 is obviously 0. So the octal value of 200 decimal is 310 octal. Now that you have this process of converting from octal to decimal and back, you can take any number, put it into your conversion chart, and easily perform that calculation.