DEC2OCT Function
Converts a decimal number to octal.
Category
Engineering
Available in
All versions, Microsoft 365
Returns
Octal text (up to 10 characters)
Overview
DEC2OCT converts a decimal number into octal. Decimal (base 10) is the everyday number system. Octal (base 8) uses the digits 0–7.
The input must be from −536,870,912 to 536,870,911, or DEC2OCT returns #NUM!. Negative numbers use a fixed 10-character form called two's complement: the first digit acts as the minus sign. For example −1 is 1111111111 in binary, 7777777777 in octal and FFFFFFFFFF in hex.
Syntax
Arguments
| Argument | Required? | What it does |
|---|---|---|
| number | Yes | The whole number to convert, from −536,870,912 to 536,870,911. Any decimal part is dropped (3.9 is treated as 3). |
| places | No | How many characters to show, padding with leading zeros (e.g. 8 turns 101 into 00000101). Ignored for negative numbers. |
Examples
Example 1 — Decimal to octal
Each row converts the value in column A.
| A | B | |
|---|---|---|
| 1 | Decimal | Octal |
| 2 | 8 | 10 |
| 3 | 64 | 100 |
| 4 | 493 | 755 |
| 5 | -100 | 7777777634 |
Example 2 — File permission codes
Unix and Linux file permissions are written in octal. A system export lists them as decimal numbers.
| A | B | C | |
|---|---|---|---|
| 1 | File | Decimal | chmod |
| 2 | report.sh | 493 | 755 |
| 3 | notes.txt | 420 | 644 |
| 4 | secret.key | 384 | 600 |
Common mistakes
- #NUM! The number is outside −536,870,912 to 536,870,911, or places is too small to fit the answer (DEC2BIN(9,2) — 9 needs four binary digits).
Notes
- The answer is text, so it keeps leading zeros. Convert back with the matching ...2DEC function before doing maths with it.
- Related functions: OCT2DEC, DEC2BIN, DEC2HEX, BASE.

Author
Kyle Stott
Certified Microsoft Excel Expert
Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.