A decimal number is a number that uses 10 as its base or radix. This means that there are 10 possible digits that can appear in a decimal number: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. For example, the number 123 is a decimal number that consists of three digits: 1, 2, and 3.
An octal number is a number that uses 8 as its base or radix. This means that there are 8 possible digits that can appear in an octal number: 0, 1, 2, 3, 4, 5, 6, and 7. For example, the number 123 is an octal number that consists of three digits: 1, 2, and 3.
The octal number system was popular in the early days of computing because it was a convenient way to represent binary numbers in groups of three bits. Each octal digit corresponds to three binary digits. For example, the binary number 101110 can be written as the octal number 56.
However, the octal system is not widely used today because most modern computers use hexadecimal numbers instead. Hexadecimal numbers use 16 as their base and have 16 possible digits: 0, 1, …,9 and A,B,C,D,E,F.
To convert a decimal number to an octal number, you need to follow these steps:
Step 1: Divide the decimal number by 8
The first step is to divide the decimal number by 8 and write down the quotient and the remainder. The quotient is the result of the division without the fractional part. The remainder is the part left over after the division.
For example, if you want to convert the decimal number 130 to an octal number, you need to divide it by 8:
130 / 8 = 16 with a remainder of 2
Step 2: Repeat step 1 with the quotient
The next step is to repeat step 1 with the quotient obtained in the previous step. You need to divide the quotient by 8 and write down the new quotient and remainder.
For example, using the quotient from step 1:
16 / 8 = 2 with a remainder of 0
Step 3: Continue until the quotient is zero
You need to continue repeating step 2 until you get a quotient of zero. This means that you have divided the decimal number by all possible powers of eight.
2 / 8 = 0 with a remainder of 2
Step 4: Write down the remainder in reverse order
The final step is to write down all the remainders you obtained in steps 1-3 in reverse order. This will give you the octal equivalent of the decimal number.
The remainders from steps 1-3 are:
- Step 1: Remainder = 2
- Step 2: Remainder = 0
- Step 3: Remainder = 2
Writing them in reverse order gives:
130<sub>10</sub> = 202<sub>8</sub>
Example: Convert decimal to octal
Let’s convert another decimal number to an octal number using the same method. Suppose we want to convert 35631<sub>10</sub> to an octal number.
We start by dividing it by 8:
35631 / 8 = 4453 with a remainder of 7
We repeat with the quotient:
4453 / 8 = 556 with a remainder of 5
We repeat again:
556 / 8 = 69 with a remainder of 4
69 / 8 = 8 with a remainder of 5
And one more time:
8 / 8 = 1 with a remainder of 0
We stop here because we got a quotient of zero.
We write down all the remainder in reverse order:
35631<sub>10</sub> = 105457<sub>8</sub>
Decimal to Octal Conversion Table
Here is a table that shows some common decimal numbers and their octal equivalents:
You can use this table as a reference or check your answers using our decimal-to-octal converter.
Octal to Decimal Conversion
To convert an octal number to a decimal number, you need to do the opposite process of decimal-to-octal conversion. You need to multiply each digit of the octal number by its corresponding power of eight and add them up.
For example, if you want to convert the octal number 123<sub>8</sub> to a decimal number, you need to do this:
123<sub>8</sub> = (1 * (8<sup>2</sup>)) + (2 * (8<sup>1</sup>)) + (3 * (8<sup>0</sup>))
= (1 * (64)) + (2 * (8)) + (3 * (1))
= (64) + (16) + (3)
You can also use our octal-to-decimal converter for quick conversions.
Why Learn Decimal to Octal Conversion?
You might be wondering why you need to learn how to convert between decimal and octal numbers. After all, most people use decimal numbers in everyday life, and most computers use binary or hexadecimal numbers for programming.
However, there are some situations where octal numbers are useful or necessary. For example:
- Octal numbers are used for representing file permissions in Unix-like operating systems. Each file has three sets of permissions for different users: owner, group, and others. Each set has three bits for read, write, and execute permissions. These bits can be represented by an octal digit from 0 to
- For example, 644 means that the owner can read and write the file, the group can read it, and others can read it too.
- Octal numbers are used for representing IP addresses in some applications. An IP address is a unique identifier for a device on a network. It consists of four numbers from 0 to 255, separated by dots. Each number can be represented by three octal digits from 000 to
- For example, 192.168.0.1 can be written as 300.250.000.001 in octal.
- Octal numbers are used for representing some special characters in ASCII encoding. ASCII is a standard code that assigns a numerical value to each character on a keyboard. Some characters have values higher than 127 and cannot be typed directly on some keyboards or terminals. These characters can be represented by an escape sequence that starts with a backslash followed by three octal digits from 000 to
- For example, \141 represents the letter ‘a’, and \176 represents the tilde ‘~’.
These are some examples of where you might encounter octal numbers in real life or computer science. Learning how to convert between decimal and octal numbers can help you understand these applications better and perform calculations faster.
In this article, you learned what decimal and octal numbers are and how to convert between them using a simple method of repeated division and multiplication.
You also learned why octal numbers are important for some applications and how they relate to binary and hexadecimal numbers.