Google Sheets BIN2OCT Function Explained

How-to basics · Updated November 23, 2026

The Google Sheets BIN2OCT function converts a signed binary number (base 2) into a signed octal number (base 8). For example, =BIN2OCT("1010") returns 12, because binary 1010 equals octal 12.

What Is the BIN2OCT Function?

BIN2OCT is part of Google Sheets’ Engineering functions, which handle number system conversions and technical calculations. It takes a binary string (only 0s and 1s) and outputs the equivalent octal representation. Octal uses digits 0–7, so each octal digit represents three binary bits. This function is useful for programmers, network engineers, and students working with digital logic or low-level data.

Syntax and Arguments

The syntax is:

BIN2OCT(signed_binary_number, [significant_digits])
  • signed_binary_number (required): The binary number you want to convert. It must be a string of 0s and 1s, up to 10 characters (10 bits). The most significant bit is the sign bit: 0 for positive, 1 for negative.
  • significant_digits (optional): The number of digits you want in the result. If omitted, Google Sheets returns the minimum necessary digits. If provided, the result is padded with leading zeros to that length.

For example, =BIN2OCT("111", 4) returns 0007 (binary 111 = octal 7, padded to 4 digits).

How It Handles Negative Numbers

Binary numbers in BIN2OCT use two’s complement representation for negatives. A 10-bit signed binary number can represent values from -512 to 511. If the first bit is 1, the number is negative. For instance, =BIN2OCT("1111111111") returns 7777777777, which is the octal representation of -1 in 10-bit two’s complement. Google Sheets automatically interprets the sign bit, so you don’t need to manually convert.

Common Errors and Troubleshooting

  • #NUM! error: Occurs if the binary number has more than 10 characters, or if the significant_digits argument is negative or too large (over 10).
  • #VALUE! error: Occurs if the binary number contains characters other than 0 and 1, or if the significant_digits argument is not a number.
  • Leading zeros: If you input a binary number with leading zeros (e.g., “00101”), Google Sheets ignores them and treats it as “101”.

If you get an unexpected result, double-check that your binary string is properly quoted. Without quotes, Google Sheets might interpret it as a number, which can cause errors or unintended conversions.

Practical Examples

Here are a few real-world uses:

  • Convert an IP address’s binary octet to octal: =BIN2OCT("11000000") returns 300.
  • Pad results for fixed-width output: =BIN2OCT("101", 5) returns 00005.
  • Combine with other functions: =BIN2OCT(DEC2BIN(255)) converts decimal 255 to binary, then to octal, returning 377.

Remember that BIN2OCT only works with binary input. If you have a decimal number, use DEC2OCT directly, or convert it to binary first with DEC2BIN.

Comparison with Excel’s BIN2OCT

Microsoft Excel also has a BIN2OCT function with identical syntax and behavior. The main difference is that Excel’s version may handle errors slightly differently (e.g., Excel returns #NUM! for the same invalid inputs). In Google Sheets, the function is available in all modern browsers, while in Excel it is part of the Analysis ToolPak (though it’s usually installed by default). If you’re sharing spreadsheets between the two, the formulas will work identically.

Alternatives and Related Functions

Google Sheets offers several other conversion functions:

  • BIN2DEC – binary to decimal
  • BIN2HEX – binary to hexadecimal
  • OCT2BIN – octal to binary
  • DEC2OCT – decimal to octal

If you need to convert a binary number that exceeds 10 bits, consider splitting it into chunks or using a custom formula with SUMPRODUCT for larger values, though that’s more complex.

Frequently Asked Questions

Can BIN2OCT convert a binary number with more than 10 bits?

No. The function is limited to 10 bits (including the sign bit). For larger numbers, you’d need to split them or use a custom script.

Why does BIN2OCT return a negative octal for a binary starting with 1?

Because the first bit is treated as the sign bit in two’s complement. This is standard for signed binary representation, which BIN2OCT uses.

How do I convert a binary number stored as a number (not text)?

Wrap it in the TEXT function or use BIN2OCT(TEXT(A1,"0000000000")) to ensure it’s treated as a string. Otherwise, Google Sheets may drop leading zeros.

What happens if I omit the significant_digits argument?

Google Sheets returns the minimum number of octal digits needed, without leading zeros. For example, =BIN2OCT("1010") returns 12, not 00012.

Is BIN2OCT available in Google Sheets mobile app?

Yes, the function works in the Google Sheets mobile apps for Android and iOS, as long as you type it correctly. It behaves the same as in the web version.

Can I use BIN2OCT in conditional formatting or data validation?

You can use it in custom formulas for conditional formatting, but not directly in data validation criteria. For validation, you’d need to create a helper column with the conversion.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.