Google Sheets BIN2DEC Function Explained

How-to basics · Updated November 23, 2026

The Google Sheets BIN2DEC function converts a signed binary number (base 2) into its decimal equivalent (base 10). For example, =BIN2DEC("1010") returns 10, and =BIN2DEC("1111111111") returns -1 because it interprets the 10-bit value as a two’s complement signed number.

What Is BIN2DEC and When to Use It

BIN2DEC is one of several engineering conversion functions in Google Sheets, alongside HEX2DEC, OCT2DEC, DEC2BIN, and others. You use it when you have binary data—like values from a digital system, a network mask, or a bitmask—and you need to see or calculate with the number in decimal form. The function is particularly handy in electronics, programming, and data analysis where binary representations are common.

Because Google Sheets stores numbers in decimal by default, BIN2DEC lets you bridge the gap between raw binary strings and numeric values you can use in arithmetic, charts, or further formulas.

Syntax and Arguments

The syntax is straightforward:

=BIN2DEC(signed_binary_number)
  • signed_binary_number – the binary number you want to convert. It must be a text string or a reference to a cell containing the binary number as text.
  • The input can be up to 10 bits (including the sign bit). The most significant bit is treated as the sign bit in two’s complement representation.
  • If you enter a number directly without quotes, Google Sheets may interpret it as a decimal number, so it’s safest to use quotes, e.g., =BIN2DEC("1101").

Examples:

  • =BIN2DEC("0") returns 0.
  • =BIN2DEC("1") returns 1.
  • =BIN2DEC("101") returns 5.
  • =BIN2DEC("1111111111") returns -1 (because 10 ones in two’s complement is -1).

Understanding Signed Binary Numbers

This is the most common source of confusion. BIN2DEC does not treat the binary string as an ordinary positive integer if it is 10 bits long. Instead, it uses two’s complement notation for signed numbers. In two’s complement:

  • The leftmost bit is the sign bit. If it’s 0, the number is positive; if it’s 1, the number is negative.
  • For positive numbers, the remaining bits represent the magnitude directly.
  • For negative numbers, you invert all bits and add 1 to get the magnitude.

Example: =BIN2DEC("1111111111"). The leftmost bit is 1, so it’s negative. Invert the remaining bits (000000000) and add 1 gives 1, so the result is -1.

If you want to treat a 10-bit binary string as an unsigned positive number, you need to prepend a leading zero, making it 11 bits, but BIN2DEC only accepts up to 10 bits. So for values above 511, you cannot directly get the unsigned decimal. Instead, you can convert manually: use =BIN2DEC("0"&A1) but that would exceed 10 bits. The practical workaround is to split the binary string into two parts and combine, or use a custom formula. For most everyday uses, the signed interpretation is what you want.

How to Use BIN2DEC in Google Sheets

Using it is simple:

  1. Click on a cell where you want the decimal result.
  2. Type =BIN2DEC(.
  3. Enter the binary number as a string (in quotes) or click a cell that contains the binary number as text.
  4. Press Enter.

For example, if cell A1 contains the text “1101”, you can enter =BIN2DEC(A1) in B1 and get 13.

Note: The input must be text. If you type a number like 1101 without quotes, Sheets may treat it as a decimal number (one thousand one hundred one) and then try to convert it, which will give an error. To avoid this, format the source cells as text (Format > Number > Plain text) or use the TEXT function.

Common Errors and How to Fix Them

Several errors can occur:

  • #VALUE! – The input is not a valid binary number (contains characters other than 0 and 1) or is empty.
  • #NUM! – The binary number has more than 10 bits, or the result is outside the range that Sheets can handle (though with 10 bits, the range is -512 to 511, which is fine).
  • #N/A – The input is a cell reference that is empty or not text.

To fix, ensure the binary string is exactly 1 to 10 characters long, contains only 0s and 1s, and is entered as text. If you have a longer binary number, you may need to split it or use a custom conversion formula.

Comparing BIN2DEC with Other Conversion Functions

Google Sheets offers a full set of base conversion functions:

  • DEC2BIN – converts decimal to binary.
  • HEX2DEC – converts hexadecimal to decimal.
  • OCT2DEC – converts octal to decimal.
  • BIN2HEX and BIN2OCT – convert binary to hex and octal respectively.

All of these follow similar syntax and have the same signed-bit limitations. For example, DEC2BIN also accepts up to 10 bits and uses two’s complement for negative numbers.

If you need to convert a binary number that is longer than 10 bits, these functions won’t work directly. You would need to write a custom formula using SUMPRODUCT or a script.

Practical Examples and Use Cases

Here are a few real-world scenarios:

  • Subnet mask calculation: If you have a binary subnet mask like “11111111111111111111111100000000” (24 ones), you can’t use BIN2DEC directly because it’s 32 bits. Instead, you’d convert each octet separately: =BIN2DEC("11111111") gives 255, so the mask is 255.255.255.0.
  • Reading sensor data: A sensor may output a 10-bit binary value. Use BIN2DEC to get the decimal reading.
  • Bitmask flags: If you have a set of flags encoded in a binary number, you can decode which flags are set by converting to decimal and then using bitwise operations (though Sheets doesn’t have built-in bitwise functions; you’d use SUMPRODUCT).

For example, to convert the binary string in A1 (e.g., “1010”) to decimal, use =BIN2DEC(A1) and you’ll get 10.

Frequently Asked Questions

Why does BIN2DEC return a negative number for “1111111111”?
Because the function interprets the 10-bit input as a signed two’s complement number. The leftmost bit is the sign bit; when it’s 1, the number is negative. “1111111111” is -1.

Can I convert a binary number longer than 10 bits?
No, BIN2DEC only accepts up to 10 bits. For longer binary strings, you need to split them into chunks of 8 or 10 bits and convert each separately, then combine the decimal results manually.

Does BIN2DEC work in Excel?
Yes, Excel has the same BIN2DEC function with identical syntax and behavior. The main difference is that in Excel, you might need to use the Analysis ToolPak add-in for some engineering functions, but BIN2DEC is a standard function in modern Excel versions.

What if I type =BIN2DEC(1010) without quotes?
Sheets will treat 1010 as a decimal number (one thousand ten) and try to convert it as if it were binary, which will result in a #VALUE! error because 1010 is not a valid binary string (it contains digits other than 0 and 1? Actually 1010 is valid, but it’s treated as a number, not text, and the function expects text). To avoid this, always use quotes or reference a cell formatted as text.

How do I convert a binary number to decimal without using BIN2DEC?
You can use a manual formula like =SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),2^(LEN(A1)-ROW(INDIRECT("1:"&LEN(A1))))) for positive numbers, but it’s much simpler to use BIN2DEC.

Alternatives and Limitations

If you need to convert very large binary numbers (more than 10 bits), BIN2DEC won’t work. You can use a custom Google Apps Script function or a manual formula that breaks the binary string into chunks. For example, for a 32-bit binary, split into four 8-bit chunks, convert each with BIN2DEC, and then combine: =BIN2DEC(LEFT(A1,8))*2^24 + BIN2DEC(MID(A1,9,8))*2^16 + BIN2DEC(MID(A1,17,8))*2^8 + BIN2DEC(RIGHT(A1,8)).

Also note that BIN2DEC only handles integers; it cannot convert binary fractions. For fractional binary numbers, you’d need a custom solution.

In summary, BIN2DEC is a simple, reliable function for converting 1-10 bit signed binary numbers to decimal. Just remember the signed behavior and the text input requirement, and you’ll avoid the common pitfalls.

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.