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])| Argument | What it means | |
|---|---|---|
number | Required | The 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). |
places | Optional | Minimum 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
| A | B | |
|---|---|---|
| 1 | Binary | |
| 2 | 1100100 | 144 |
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
| A | B | |
|---|---|---|
| 1 | rwx bits | |
| 2 | 111101101 | 755 |
Result: 755
The permission pattern rwx r-x r-x is 111 101 101 in binary, which is 755 in octal.
3Negative binary value
| A | B | |
|---|---|---|
| 1 | Binary | |
| 2 | 1111111111 | 7777777777 |
Result: 7777777777
Ten 1s is -1, which is 7777777777 in 30-bit octal two's complement.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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 againstchmodnotation.
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.
| Language | Function name |
|---|---|
| Danish | BIN.TIL.OKT |
| Dutch | BIN.N.OCT |
| Finnish | BINOKT |
| French | BINOCT |
| German | BININOKT |
| Hungarian | BIN.OKT |
| Italian | BINARIO.OCT |
| Norwegian (Bokmål) | BINTILOKT |
| Polish | DWÓJK.NA.ÓSM |
| Portuguese (Brazil) | BINAOCT |
| Portuguese (Portugal) | BINAOCT |
| Russian | ДВ.В.ВОСЬМ |
| Spanish | BIN.A.OCT |
| Swedish | BIN.TILL.OKT |