Decimal to Octal Converter
Going the other way? Convert octal back to decimal →
How do you convert decimal to octal?
Decimal to octal conversion divides the number by 8 over and over, keeping each remainder, then reads the remainders from the last one back to the first.
Decimal 156 is octal 234. Divide by 8 repeatedly (156 / 8 = 19 r 4, 19 / 8 = 2 r 3, 2 / 8 = 0 r 2) and read the remainders from last to first.
- Divide the number by 8 and write down the remainder. 156 ÷ 8 leaves 4.
- Divide the quotient by 8 again and keep that remainder too.
- Repeat until the quotient reaches 0.
- Read the remainders from bottom to top: 156 = 234.
Decimal to Octal Conversion Table
One hexadecimal digit equals exactly 4 bits (16 = 2⁴); one octal digit equals exactly 3 bits (8 = 2³). Hex and octal are therefore converted by grouping bits, and hex ↔ octal passes through binary. That is the whole method, so the table below is the only thing you need: every group of 3 bits has exactly one octal digit, and the mapping never changes. Binary writes values on the digit set 0, 1 with each place worth 2ⁿ, and a value marked 0b is binary; octal values are marked 0o.
| 3 bits | Octal | Decimal |
|---|---|---|
| 000 | 0 | 0 |
| 001 | 1 | 1 |
| 010 | 2 | 2 |
| 011 | 3 | 3 |
| 100 | 4 | 4 |
| 101 | 5 | 5 |
| 110 | 6 | 6 |
| 111 | 7 | 7 |
Each base is defined by three things: which digits it uses, how a value is marked, and what each position is worth.
| Base | Radix | Digits | Prefix | Place worth | Typical range |
|---|---|---|---|---|---|
| Decimal | 10 | 0–9 | none | 10ⁿ | any; decimal pages treat 0–255 as the byte range |
| Octal | 8 | 0–7 | 0o | 8ⁿ | 3 digits cover a byte (000–377); Unix permissions 000–777 |
Worked Example: 156 to Octal
One value, converted the long way so the working is visible. This is the same grid the converter shows when you turn on "show steps".
Result: 156 = 234
Divide by 8 and keep the remainder, then divide the quotient again, until the quotient reaches 0. For 156 that runs: 156 / 8 = 19 remainder 4; 19 / 8 = 2 remainder 3; 2 / 8 = 0 remainder 2.
The remainders come out least significant first, so they are read from the bottom of the list back to the top: 234. Reading them the other way is the single most common error, and it gives a number that looks plausible and is wrong. The check is quick — expand the result back and it must return 156.
Check it in reverse
The value returns unchanged. Convert 234 back and you get 156, because a base change rewrites the digits without touching the quantity they stand for. That is the whole test: if the round trip differs, a digit was misread. To check it by hand, convert the decimal value back to octal and compare it with the number you started from.
Worked examples: decimal to octal
Each example gives the value first, then the working. Click a value to load it in the converter.
What is 8 in octal?
8 in decimal is 10 in octal.
Method: divide 8 by 8 repeatedly and read the remainders bottom to top.
What is 100 in octal?
100 in decimal is 144 in octal.
Method: divide 100 by 8 repeatedly and read the remainders bottom to top.
What is 156 in octal?
156 in decimal is 234 in octal.
Method: divide 156 by 8 repeatedly and read the remainders bottom to top.
What is 10 in octal?
10 in decimal is 12 in octal.
Method: divide 10 by 8 repeatedly and read the remainders bottom to top.
What is 255 in octal?
255 in decimal is 377 in octal.
Method: divide 255 by 8 repeatedly and read the remainders bottom to top.
What is 16 in octal?
16 in decimal is 20 in octal.
Method: divide 16 by 8 repeatedly and read the remainders bottom to top.
What is 32 in octal?
32 in decimal is 40 in octal.
Method: divide 32 by 8 repeatedly and read the remainders bottom to top.
What is 64 in octal?
64 in decimal is 100 in octal.
Method: divide 64 by 8 repeatedly and read the remainders bottom to top.
What is 128 in octal?
128 in decimal is 200 in octal.
Method: divide 128 by 8 repeatedly and read the remainders bottom to top.
What is 12 in octal?
12 in decimal is 14 in octal.
Method: divide 12 by 8 repeatedly and read the remainders bottom to top.
What is 15 in octal?
15 in decimal is 17 in octal.
Method: divide 15 by 8 repeatedly and read the remainders bottom to top.
What is 20 in octal?
20 in decimal is 24 in octal.
Method: divide 20 by 8 repeatedly and read the remainders bottom to top.
Every example above reverses exactly — expand the same octal digits into a decimal value.
What About Padding, Fractions and Width?
Leading zeros and width
A number carries no leading zeros unless a width is fixed. 234 and 0234 are the same value, so the converter writes the short form. Fixed widths belong to bytes and registers, not to arithmetic. converting between binary, octal, decimal and hexadecimal covers where width does matter.
Fractions and the point
Digits after a point convert by the same rule with negative powers, so the first place after the point is worth 1/8. Many fractions that end neatly in decimal repeat forever in binary, which is where rounding creeps in.
Negative values
A minus sign is kept in front of the digits. Fixed-width binary encodes sign differently, using two's complement, and that is a separate rule from the base change itself.
How large a value can be
The method has no ceiling; each extra decimal digit multiplies the range by 10. Practical limits come from the width a machine stores the value in, not from the conversion.
Decimal to Octal in Code
The same rule in one line. Both divide repeatedly and return the digits in order.
Python: format(156, 'o') JavaScript: (156).toString(8) Common Mistakes
- Reading the remainders top to bottom. They come out in reverse, so the digits land backwards.
- Using a digit the base does not have — an 8 in octal, or a 2 in binary. The value cannot be read at all.
- Grouping bits from the left. Groups are counted from the right, and the leftmost group is the one that gets padded.
- Treating the result as a character code. 65 is a number here, not the letter A.
Frequently Asked Questions
How do you convert a decimal fraction to octal?
Multiply the fraction by 8 over and over and write down each whole part, then read those digits from the top down. 0.5 × 8 = 4.0, so 0.5 in octal is 0.4. The whole part still converts by repeated division.
How do you convert decimal to octal through binary?
Convert to binary first, then group the bits in threes from the right. 156 is 10011100, which groups as 010 011 100 and reads 234. One octal digit equals exactly 3 bits (8 = 2³), so the regrouping is exact.
How do you convert decimal to octal in Python?
Format the number in base 8: format(156, 'o') returns 234, and oct(156) returns the same digits behind the 0o prefix. The first is the one-liner under Decimal to Octal in Code.
Repeated division reverses cleanly, so the same value converts straight back in the octal to decimal direction.
Related Conversions
The rest of the family sits on pick another conversion from the grid.