Decimal to octal

Convert decimal to octal as you type, with any number of digits, the method step by step and a reference table.

loading Decimal to octal
About this tool

Decimal and octal

Decimal (base 10) is the everyday system: each digit is worth a power of 10. Octal (base 8) groups bits three by three; today it survives mostly in Unix permissions such as chmod 755.

Handy when a tool prints a permission or a mode as a decimal number and you want the familiar chmod digits back.

This page opens the base converter with decimal as the input; it shows binary, octal, decimal, hexadecimal and Base64 at once, accepts prefixes such as 0x, 0b and 0o, and works with numbers of any length (no 2^53 limit). It runs in your browser.

Decimal vs octal

Decimaloctal
Base108
Digits0–90–7
Prefix in code—0o
255 is written255377

How to convert decimal to octal by hand

Divide by 8 again and again and write down the remainders; read them from the last to the first. For 156:

DivisionQuotientRemainder
156 ÷ 8194
19 ÷ 823
2 ÷ 802

Read upwards: 156 = 234 in octal.

Decimal to octal table

Values computed by the converter itself:

DecimalOctal
00
11
22
77
810
1012
1517
1620
3240
64100
100144
127177
255377
256400
10001750
10242000
409610000
65535177777

Decimal to octal in code

JavaScript

(156).toString(8); // '234'

Python

format(156, "o")  # '234'

For integers beyond 2^53 in JavaScript, use BigInt: BigInt("0x…").toString(8).

Frequently asked questions

Does it handle very large numbers?

Yes. The converter uses arbitrary-precision integers (BigInt), so a 256-bit hash or a 100-digit number converts exactly; JavaScript Number would lose digits above 2^53.

Can I convert negative numbers or fractions?

Negative integers keep their sign (-255 → -FF); the tool does not write two’s complement or fractional digits. For a two’s complement byte, add 256 first (−1 → 255 → FF).

Why do programmers use hexadecimal instead of binary?

Because it is binary in short form: 4 bits per digit, 2 digits per byte, so 0xFF is easier to read than 11111111 and still maps bit for bit.

Report a problem