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])| Argument | What it means | |
|---|---|---|
number | Required | The 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). |
places | Optional | Minimum 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
| A | B | |
|---|---|---|
| 1 | Octal | |
| 2 | 5 | 101 |
Result: 101
Octal 5 is 4 + 1, so the three permission bits are read-on, write-off, execute-on: 101.
2A full permission code
| A | B | |
|---|---|---|
| 1 | Octal | |
| 2 | 754 | 111101100 |
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
| A | B | |
|---|---|---|
| 1 | Octal | |
| 2 | 7777777000 | 1000000000 |
Result: 1000000000
This octal value is -512, the smallest number a 10-bit two's-complement binary can hold, so the result is 1000000000.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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.
| Language | Function name |
|---|---|
| Danish | OKT.TIL.BIN |
| Dutch | OCT.N.BIN |
| Finnish | OKTBIN |
| French | OCTBIN |
| German | OKTINBIN |
| Hungarian | OKT.BIN |
| Italian | OCT.BINARIO |
| Norwegian (Bokmål) | OKTTILBIN |
| Polish | ÓSM.NA.DWÓJK |
| Portuguese (Brazil) | OCTABIN |
| Portuguese (Portugal) | OCTABIN |
| Russian | ВОСЬМ.В.ДВ |
| Spanish | OCT.A.BIN |
| Swedish | OKT.TILL.BIN |