Summary

The Excel OCT2BIN function converts an octal number to its binary equivalent. For example, the following formula converts the octal number 2 to binary:

=OCT2BIN(2) // returns 10 (binary)

Purpose 

Convert octal number to binary

Return value 

Binary number

Syntax

=OCT2BIN(number,[places])
  • number - The octal number you want to convert.
  • places - [optional] The number of characters to use. If omitted, the function uses the minimum number of characters necessary.

Using the OCT2BIN function 

The OCT2BIN function is used to convert octal numbers (base 8) to binary numbers (base 2). This is useful when working with different number systems, especially in engineering and computer science applications.

Key features

  • Converts octal numbers to binary numbers
  • Supports optional padding with leading zeros
  • Handles both positive and negative octal numbers (using two's-complement for negatives)
  • Returns a text string representing the binary number

To get the octal representation of a decimal number, use the DEC2OCT function.

Table of contents

Example #1 - Basic conversion

To convert the octal number 11 to binary, use the following formula:

=OCT2BIN(11) // returns 1001 (binary)

Example #2 - Padding with leading zeros

To convert the octal number 11 to binary, padded to 10 characters, use the following formula:

=OCT2BIN(11, 10) // returns 00000001001 (binary)

Example #3 - Negative octal numbers

Excel represents negative numbers in non-decimal bases (like octal and binary) using two's complement notation with a fixed width of 10 characters. This means that when you use OCT2BIN with a negative octal number, Excel interprets the input as a two's complement value and returns a 10-character binary string.

For example, to represent the decimal number -3 in octal, you would use the octal number 7777777775. This is because the most significant digit is the sign bit, and the remaining 9 digits represent the magnitude.

=DEC2OCT(-3) // returns 7777777775

Then, when we convert the octal number to binary, we get the following result:

=OCT2BIN(7777777775) // returns 1111111101

This is because the most significant bit is the sign bit, and the remaining 9 digits represent the magnitude.

Example #4 - Limits and range

The OCT2BIN function is limited to binary numbers with a maximum of 10 digits. If you try to convert an octal number that would require more than 10 binary digits, OCT2BIN returns the #NUM! error.

The table below shows what happens at the boundaries:

Screenshot showing the limits and range of the OCT2BIN function in Excel. The largest positive octal value that can be converted is 777 (decimal 511), and the smallest negative octal value is 7777777000 (decimal -512). Values outside this range return a #NUM! error.

The largest positive number you can convert is octal 777 (decimal 511). The smallest negative number you can convert is octal 7777777000 (decimal -512). Any value outside this range returns a #NUM! error.

Error handling

  • If the input is outside the allowed range (e.g., 7777776777 or 1000), OCT2BIN returns the #NUM! error value.
  • If the input is non-numeric (e.g., Text), OCT2BIN returns the #NUM! error value.
  • If the input is not a valid octal number (e.g., 80), OCT2BIN returns the #NUM! error value.
  • If the input is not an integer (e.g., 10.5), OCT2BIN returns the #NUM! error value.
  • If the input is negative (e.g., -4), OCT2BIN returns the #NUM! error value.
Dave Bruns Profile Picture

AuthorMicrosoft Most Valuable Professional Award

Dave Bruns

Hi - I'm Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.