How to Convert a Decimal Number to Octal

Table of contents:

How to Convert a Decimal Number to Octal
How to Convert a Decimal Number to Octal
Anonim

This article shows you how to convert a decimal number to an octal number. The octal numbering system is based on the use of the numbers 0 to 7. The main advantage that comes with this numbering system is the ease with which it is possible to convert an octal number into binary, since the numbers that compose it can be all represented with a three-digit binary number. The procedure for converting a decimal number into its corresponding octal is slightly more complex, but the only mathematical tool you need to know is the mechanism by which the divisions are carried out in the column. This guide shows two conversion methods, but it is better to start from the first which is based precisely on the divisions in columns using the powers of the number 8. The second method is faster and uses operations similar to the first, but its operation is a little more difficult to understand and assimilate.

Steps

Method 1 of 2: Using Column Divisions

Convert from Decimal to Octal Step 1
Convert from Decimal to Octal Step 1

Step 1. Start with this method to understand the conversion mechanism

Of the two methods described in the article, this is the simplest to understand. If you are already familiar with using different numbering systems, you can directly try the second method which is faster

Convert from Decimal to Octal Step 2
Convert from Decimal to Octal Step 2

Step 2. Make a note of the decimal number to convert

For example try converting the decimal number 98 to octal.

Convert from Decimal to Octal Step 3
Convert from Decimal to Octal Step 3

Step 3. List the powers of the number 8

Remember that the decimal system is a "base 10" positional number system because each digit of a number represents a power of 10. The first digit of a decimal number (starting from the least significant ie from right to left) represents units, the second the tens, the third the hundreds and so on, but we can also represent them as powers of 10 obtaining: 100 for units, 101 for the tens and 102 for hundreds. The octal system is a "base 8" positional number system that uses the powers of the number 8 instead of 10. List the first powers of the number 8 on a single horizontal line. Start from the largest to get to the smallest. Note that all the numbers you are using are decimal, ie in "base 10":

  • 82 81 80
  • Rewrite the listed powers in the form of decimal numbers i.e. perform the mathematical calculations:
  • 64 8 1
  • To convert the starting decimal number (in this case 98) you do not need to use any power that gives a higher number as a result. Since the power 83 represents the number 512, and 512 is greater than 98, you can exclude it from the list.
Convert from Decimal to Octal Step 4
Convert from Decimal to Octal Step 4

Step 4. Start by dividing the decimal number by the largest power of 8 you found

Examine the starting number: 98. The nine represents tens and indicates that the number 98 is made up of 9 tens. Turning to the octal system you need to find out what value the position destined to the "tens" of the final number represented by the power 8 will occupy2 or "64". To solve the mystery, simply divide the number 98 by 64. The simplest way to do the calculation is to use the column divisions and the pattern below:

  • 98

    ÷

  • 64 8 1

    =

  • Step 1. ← The result obtained represents the most significant digit of the final octal number.
Convert from Decimal to Octal Step 5
Convert from Decimal to Octal Step 5

Step 5. Calculate the remainder of the division

This is the difference between the starting number and the product of the divisor and the result of the division. Write the result at the top of the second column. The number you will get is the remainder left over after calculating the first digit of the division result. In the example conversion you have obtained 98 ÷ 64 = 1. Since 1 x 64 = 64 the remainder of the operation is equal to 98 - 64 = 34. Report it in the graphic scheme:

  • 98 34

    ÷

  • 64 8 1

    =

  • 1
Convert from Decimal to Octal Step 6
Convert from Decimal to Octal Step 6

Step 6. Continue dividing the remainder by the next power of 8

To find the next digit of the final octal number, you will need to continue dividing it using the next power of 8 from the list you created in the first steps of the method. Perform the division indicated in the second column of the diagram:

  • 98 34

    ÷ ÷

  • 64

    Step 8. 1

    = =

  • 1

    Step 4.

Convert from Decimal to Octal Step 7
Convert from Decimal to Octal Step 7

Step 7. Repeat the above procedure until you have obtained all the digits that make up the final result

As indicated in the previous step, after performing the division, you will need to calculate the remainder and report it in the first line of the diagram, next to the previous one. Continue your calculations until you have used all powers of 8 listed, including power 80 (relative to the least significant digit of the octal system that occupies the place of units in the decimal system). In the last line of the diagram the octal number has appeared, which represents the starting decimal number. Below you will find the graphic scheme of the whole conversion process (note that the number 2 is the remainder of the division of the number 34 by 8):

  • 98 34

    Step 2.

    ÷ ÷ ÷

  • 64 8

    Step 1.

    = = =

  • 1 4

    Step 2.

  • The end result is: 98 in base 10 equals 142 in base 8. You can also report it in the following way 9810 = 1428.
Convert from Decimal to Octal Step 8
Convert from Decimal to Octal Step 8

Step 8. Verify that your work is correct

To check if the result is correct, multiply each digit that makes up the octal number by the power of 8 it represents and add up. The result you get should be the starting decimal number. Check the correctness of the octal number 142:

  • 2 x 80 = 2 x 1 = 2
  • 4 x 81 = 4 x 8 = 32
  • 1 x 82 = 1 x 64 = 64
  • 2 + 32 + 64 = 98, that is the decimal number you started from.
Convert from Decimal to Octal Step 9
Convert from Decimal to Octal Step 9

Step 9. Practice to become familiar with the method

Use the procedure described to convert the decimal number 327 to octal. After getting your result, highlight the text portion below to find out the complete solution to the problem.

  • Select this area with the mouse:
  • 327 7 7

    ÷ ÷ ÷

  • 64 8 1

    = = =

  • 5 0 7
  • The correct solution is 507.
  • Hint: It is correct to get the number 0 as a result of a division.

Method 2 of 2: Using the Rest

Convert from Decimal to Octal Step 10
Convert from Decimal to Octal Step 10

Step 1. Start with any decimal number to convert

For example use the number 670.

The conversion method described in this section is faster than the previous one which consists of performing a series of divisions in succession. Most people find this conversion method harder to understand and master, so it may be easier to start with the first method

Convert from Decimal to Octal Step 11
Convert from Decimal to Octal Step 11

Step 2. Divide the number to convert by 8

For the moment, ignore the result of the split. You will soon find out why this method is so useful and fast.

Using the example number you will get: 670 ÷ 8 = 83.

Convert from Decimal to Octal Step 12
Convert from Decimal to Octal Step 12

Step 3. Calculate the remainder

The remainder of the division represents the difference between the starting number and the product of the divisor and the division result obtained in the previous step. The remainder obtained represents the least significant digit of the final octal number, that is, the one that occupies the position relative to the power 80. The remainder of the division is always a number less than 8, so it can only represent digits of the octal system.

  • Continuing with the previous example you will get: 670 ÷ 8 = 83 with remainder 6.
  • The final octal number will be equal to ??? 6.
  • If your calculator has the key to calculate the "module", usually characterized by the abbreviation "mod", you can directly calculate the remainder of the division by entering the command "670 mod 8".
Convert from Decimal to Octal Step 13
Convert from Decimal to Octal Step 13

Step 4. Divide the result from the previous operation again by 8

Take note of the rest of the previous division and repeat the operation using the result obtained earlier. Put the new result aside and calculate the rest. The latter will correspond to the second least significant digit of the final octal number corresponding to the power 81.

  • Continuing with the example problem you will have to start from the number 83, the quotient of the previous division.
  • 83 ÷ 8 = 10 with remainder 3.
  • At this point the final octal number is equal to ?? 36.
Convert from Decimal to Octal Step 14
Convert from Decimal to Octal Step 14

Step 5. Divide the result again by 8

As happened in the previous step, take the quotient of the last division and divide it again by 8 then calculate the remainder. You will get the third digit of the final octal number corresponding to the power 82.

  • Continuing with the example problem you will have to start from number 10.
  • 10 ÷ 8 = 1 with remainder 2.
  • Now the final octal number is? 236.
Convert from Decimal to Octal Step 15
Convert from Decimal to Octal Step 15

Step 6. Repeat the calculation again to find the last remaining digit

The result of the last division should always be 0. In this case the remainder will correspond to the most significant digit of the final octal number. At this point, the conversion of the starting decimal number into the corresponding octal number is complete.

  • Continuing with the example problem you will have to start from number 1.
  • 1 ÷ 8 = 0 with remainder 1.
  • The final solution to the example conversion problem is 1236. You can report this using the following notation 12368 to indicate that it is an octal and not a decimal number.
Convert from Decimal to Octal Step 16
Convert from Decimal to Octal Step 16

Step 7. Understand why this conversion method works

If you haven't understood what the hidden mechanism behind this conversion system is, here is the detailed explanation:

  • In the example problem you started with the number 670 which corresponds to 670 units.
  • The first step consists in dividing the 670 units into many groups of 8 elements. All units advancing from the split, i.e. the rest, which cannot represent power 81 they must necessarily correspond to the "units" of the octal system represented by the power 8 instead0.
  • Now divide the number obtained in the previous step again into groups of 8. At this point, each element identified is made up of 8 groups of 8 units each for a total of 64 units overall. The remainder of this division represents elements that do not correspond to the "hundreds" of the octal system, represented by the power 82, which therefore must necessarily be the "tens" corresponding to the power 81.
  • This process continues until all digits of the final octal number have been discovered.

Example Problems

  • Practice trying to convert these decimal numbers to octal ones yourself using both methods described in the article. When you think you have obtained the correct answer, select the lower part of this section with the mouse to view the solutions for each problem (remember that the notation 10 indicates a decimal number, while that 8 indicates an octal number).
  • 9910 = 1438
  • 36310 = 5538
  • 5.21010 = 121328
  • 47.56910 = 1347218

Recommended: