gettoolz.app

Decimal to octal converter

Convert decimal numbers to octal — by repeated division by 8, every step shown. Exact at any size, with a worked example and a table of common values. Free, and computed in your browser.

Part of developer tools.

Base

Binary

10101101

Octal

255

Decimal

173

Hexadecimal

AD

Decimal to octal table

DecimalOctal
00
11
22
33
44
55
66
77
810
911
1012
1113
1214
1315
1416
1517
1620
100144
127177
255377
256400
10001750
10242000
409610000
65535177777
429496729537777777777
184467440737095516151777777777777777777777

The last rows are the largest 32-bit and 64-bit unsigned values. The second is past the point where ordinary JavaScript numbers start rounding; the table and the converter above both compute with BigInt, so every digit is exact.

How to convert decimal to octal

Divide the decimal number by 8, write down the remainder, and repeat with the quotient until it reaches 0. The remainders, read from the last one back to the first, are the octal digits. For 173: 173 ÷ 8 = 21 remainder 5; 21 ÷ 8 = 2 remainder 5; 2 ÷ 8 = 0 remainder 2. Read upwards, that is 255. Remainders are always 0 to 7. If dividing by 8 feels error-prone, go to binary first and group the bits by three: 10101101 → 010 101 101 → 255.

Decimal and octal side by side

The largest 16-bit value is 65535 in decimal and 177777 in octal: 5 digits against 6. A decimal digit is worth log₂ 10 ≈ 3.32 bits, against 3 for an octal digit — not a whole ratio, so decimal and octal digits never line up and there is no digit-by-digit shortcut: the whole number has to be divided down, as above. Octal survives mainly in Unix file permissions, where each digit is one read-write-execute triplet: 755 is rwx r-x r-x. In JavaScript and Python source, 173 is written 173 with no prefix in decimal and 0o255 in octal. Paste a prefixed number into the converter and it switches to the matching base; a number with no prefix is read in the selected base — decimal on this page.

Other conversions

Going the other way? Octal to decimal converter.

Or open the full number base converter and see a number in all four bases at once.