Engineering function

BIN2OCT function

Converts a binary number to octal text, for example "1100100" to "144". Optional padding with leading zeros.

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

BIN2OCT(number, [places])
ArgumentWhat it means
numberRequiredThe binary number to convert, as text or a number. At most 10 characters (10 bits): -512 to 511. A 10-character value whose first digit is the highest one is read as negative (two's complement).
placesOptionalMinimum number of characters to return, padded with leading zeros. Ignored when the result is negative.

Returns: Text containing the octal digits.

How BIN2OCT works

BIN2OCT rewrites a binary number in octal (base 8). Each octal digit holds three bits, so the conversion simply groups the bits in threes from the right: 001 100 100 reads as 1 4 4. It is mainly used for Unix-style permission masks and in teaching number systems.

Up to 10 binary digits are accepted. A 10-digit input that begins with 1 is negative (two's complement) and comes back as 10 octal digits; places only pads positive results. Inputs with characters other than 0 and 1 give #NUM!.

Examples

1Convert to octal

B2fx=BIN2OCT(A2)
AB
1Binary
21100100144

Result: 144

Grouping the bits in threes from the right gives 1 | 100 | 100, which is 144 in octal (100 in decimal).

2Permission bits padded to 3 digits

B2fx=BIN2OCT(A2, 3)
AB
1rwx bits
2111101101755

Result: 755

The permission pattern rwx r-x r-x is 111 101 101 in binary, which is 755 in octal.

3Negative binary value

B2fx=BIN2OCT(A2)
AB
1Binary
211111111117777777777

Result: 7777777777

Ten 1s is -1, which is 7777777777 in 30-bit octal two's complement.

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

Common errors and how to fix them

ErrorWhy it happensFix
#NUM!The input is longer than 10 characters or not valid binary, or places is too small or negative.Check the input and increase places.

Tips

  • Store binary inputs as text so leading zeros are kept and nothing is rounded.
  • =BIN2OCT(A2,3) is a quick way to check a permission mask against chmod notation.

Google Sheets

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

BIN2OCT 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
DanishBIN.TIL.OKT
DutchBIN.N.OCT
FinnishBINOKT
FrenchBINOCT
GermanBININOKT
HungarianBIN.OKT
ItalianBINARIO.OCT
Norwegian (Bokmål)BINTILOKT
PolishDWÓJK.NA.ÓSM
Portuguese (Brazil)BINAOCT
Portuguese (Portugal)BINAOCT
RussianДВ.В.ВОСЬМ
SpanishBIN.A.OCT
SwedishBIN.TILL.OKT