Engineering function

OCT2BIN function

Converts an octal number to binary text, for example "3" to "11". Only values from -512 to 511 fit in the 10-bit result.

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

OCT2BIN(number, [places])
ArgumentWhat it means
numberRequiredThe octal number to convert, as text or a number. At most 10 characters (30 bits): -536,870,912 to 536,870,911. 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 binary digits.

How OCT2BIN works

OCT2BIN expands each octal digit into three bits, which makes it a good way to show what an octal permission code actually switches on: 7 becomes 111 (read, write, execute), 5 becomes 101 (read and execute).

Because binary results are limited to 10 bits, positive inputs can be at most 777 (511) and negative inputs must be 10 digits from 7777777000 (-512) to 7777777777 (-1). Larger values return #NUM!. places pads positive results with leading zeros.

Examples

1One permission digit as bits

B2fx=OCT2BIN(A2, 3)
AB
1Octal
25101

Result: 101

Octal 5 is 4 + 1, so the three permission bits are read-on, write-off, execute-on: 101.

2A full permission code

B2fx=OCT2BIN(A2, 9)
AB
1Octal
2754111101100

Result: 111101100

Each octal digit becomes three bits: 7 → 111, 5 → 101, 4 → 100, giving 111101100 (rwx r-x r--).

3Most negative 10-bit value

B2fx=OCT2BIN(A2)
AB
1Octal
277777770001000000000

Result: 1000000000

This octal value is -512, the smallest number a 10-bit two's-complement binary can hold, so the result is 1000000000.

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

Common errors and how to fix them

ErrorWhy it happensFix
#NUM!The value is outside -512 to 511, contains 8 or 9, or places is too small.Use =BASE(OCT2DEC(A2),2) for larger positive values.

Tips

  • Use places = 3 per octal digit (3, 6 or 9) to keep the bit groups aligned with the octal digits.

Google Sheets

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

OCT2BIN 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
DanishOKT.TIL.BIN
DutchOCT.N.BIN
FinnishOKTBIN
FrenchOCTBIN
GermanOKTINBIN
HungarianOKT.BIN
ItalianOCT.BINARIO
Norwegian (Bokmål)OKTTILBIN
PolishÓSM.NA.DWÓJK
Portuguese (Brazil)OCTABIN
Portuguese (Portugal)OCTABIN
RussianВОСЬМ.В.ДВ
SpanishOCT.A.BIN
SwedishOKT.TILL.BIN