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
| Decimal | octal | |
|---|---|---|
| Base | 10 | 8 |
| Digits | 0–9 | 0–7 |
| Prefix in code | — | 0o |
| 255 is written | 255 | 377 |
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:
| Division | Quotient | Remainder |
|---|---|---|
| 156 ÷ 8 | 19 | 4 |
| 19 ÷ 8 | 2 | 3 |
| 2 ÷ 8 | 0 | 2 |
Read upwards: 156 = 234 in octal.
Decimal to octal table
Values computed by the converter itself:
| Decimal | Octal |
|---|---|
0 | 0 |
1 | 1 |
2 | 2 |
7 | 7 |
8 | 10 |
10 | 12 |
15 | 17 |
16 | 20 |
32 | 40 |
64 | 100 |
100 | 144 |
127 | 177 |
255 | 377 |
256 | 400 |
1000 | 1750 |
1024 | 2000 |
4096 | 10000 |
65535 | 177777 |
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.