DEC2OCT Function

Converts a decimal number to octal.

Category

Engineering

Available in

All versions, Microsoft 365

Returns

Octal text (up to 10 characters)

Want to practice DEC2OCT in a real spreadsheet? Open a blank sheet in our Practice Sandbox and try it with live data, with the AI Excel tutor beside you. No Excel needed — just a free account.Try it free in the Sandbox

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

=DEC2OCT(number, [places])

Arguments

ArgumentRequired?What it does
numberYesThe whole number to convert, from −536,870,912 to 536,870,911. Any decimal part is dropped (3.9 is treated as 3).
placesNoHow 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.

B2fx=DEC2OCT(A2)
AB
1DecimalOctal
2810
364100
4493755
5-1007777777634
=DEC2OCT(A2) Explain

Example 2 — File permission codes

Unix and Linux file permissions are written in octal. A system export lists them as decimal numbers.

C2fx=DEC2OCT(B2)
ABC
1FileDecimalchmod
2report.sh493755
3notes.txt420644
4secret.key384600
=DEC2OCT(B2) Explain

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.
Kyle Stott

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.