Engineering function

DEC2OCT function

Converts a decimal number to octal (base-8) text, such as 58 to "72". Negatives come back as 10-digit two's complement.

Available in Excel 2007 and later (Excel 2003 needed the Analysis ToolPak add-in), Microsoft 365, Excel for the web, Excel for Mac

Excel 2007 and laterWorks in Google Sheets

Syntax

DEC2OCT(number, [places])
ArgumentWhat it means
numberRequiredThe decimal whole number to convert, from -536,870,912 to 536,870,911. Decimals are truncated.
placesOptionalMinimum number of characters, padded with leading zeros. Ignored for negative numbers.

Returns: Text containing octal digits 0–7.

How DEC2OCT works

DEC2OCT writes a decimal number in octal, the base-8 system that uses only the digits 0 to 7. Octal is less common than hex today, but you still meet it in Unix and Linux file permissions (chmod 755), some older aviation and industrial systems, and computing courses. Each octal digit represents exactly three bits.

The output is text. Use places for a fixed width, such as 3 for a permission triple. Negative numbers come back as 10 octal digits in two's complement (30 bits): -1 becomes 7777777777, and places is ignored for them. Numbers outside about ±536.9 million return #NUM!; the reverse conversion is OCT2DEC.

Examples

1Convert to octal with padding

B2fx=DEC2OCT(A2, 3)
AB
1Decimal
258072

Result: 072

58 = 7×8 + 2, so the octal form is 72; places = 3 pads it to 072.

2Unix permission bits

B2fx=DEC2OCT(A2)
AB
1Permission value
2493755

Result: 755

A program reported the file mode as 493 in decimal. In octal that is 755: read, write and execute for the owner, read and execute for everyone else.

3A negative number

B2fx=DEC2OCT(A2)
AB
1Decimal
2-1007777777634

Result: 7777777634

Excel adds 2^30 to -100 and writes the result in octal, giving the 10-digit two's-complement form 7777777634.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
#NUM!The number is out of range, the result needs more digits than places, or places is negative.Increase places or use =BASE(number, 8) for large positive numbers.
#VALUE!An argument is non-numeric text.Convert the input with VALUE.

Tips

  • Each octal digit is three bits, so =DEC2BIN(A2, 9) and =DEC2OCT(A2, 3) show the same permission pattern in two ways.
  • For positive numbers larger than the limit, =BASE(number, 8) works up to 2^53.

Google Sheets

DEC2OCT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

DEC2OCT in other languages

In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.

LanguageFunction name
DanishDEC.TIL.OKT
DutchDEC.N.OCT
FinnishDESOKT
FrenchDECOCT
GermanDEZINOKT
HungarianDEC.OKT
ItalianDECIMALE.OCT
Norwegian (Bokmål)DESTILOKT
PolishDZIES.NA.ÓSM
Portuguese (Brazil)DECAOCT
Portuguese (Portugal)DECAOCT
RussianДЕС.В.ВОСЬМ
SpanishDEC.A.OCT
SwedishDEC.TILL.OKT