Contact

BIN2DEC in Google Sheets: Decode Signed Binary and Preserve Source Width

Engineering Intermediate Google Sheets

Decode binary strings in Google Sheets, reproduce the ten-bit signed boundaries and avoid confusing digit strings with decimal arithmetic.

Verification status: See the evidence and test scope described in this guide. How formula examples are checked

Quick answer: BIN2DEC(signed_binary_number) interprets binary digits and returns a decimal value. Google’s signed format is ten-bit two’s complement: full-width values beginning with 1 occupy the negative half of that encoding.

Availability and version history

  • Introduced: first introduction date is not established by the reviewed official history; no desktop release number is inferred.
  • Availability: documented in the rolling Google Sheets service; these examples use the web worksheet workflow.
  • Checked: October 14, 2026; official BIN2DEC reference. Documentation and independent models, with no native Sheets execution or wider client certification.

Syntax and documented conversion

=BIN2DEC(signed_binary_number)

Google describes the input as a signed ten-bit string, with positive endpoint 0111111111 and negative endpoint 1000000000. Only digits 0 and 1 are valid; other digits produce documented #NUM! errors.

A valid numeric input is converted to the corresponding string representation. Google’s explicit example makes BIN2DEC(100) and BIN2DEC("100") both return 4. This does not mean 100 is already a decimal quantity of four; the function interprets those digits in base two.

The source does not supply a complete whitespace, excessive-length or mixed-error table. Those native boundaries remain unverified. The examples use explicit valid strings, small supported numeric representations and the documented signed endpoints.

Example 1: import binary values with leading zeros

Set A2:A7 to Plain text before entering the following. Put =BIN2DEC(A2) in B2 and fill through B7.

A, binary text Expected decimal
10 2
110 6
0110 6
10101 21
11111111 255
0111111111 511

For 10101, the set bit weights are 16, 4 and 1, totaling 21. The strings 110 and 0110 both represent 6; the leading zero preserves a field width but contributes no value.

Retain the original text column if the file format needs that exact width. The decoded decimal number 6 alone cannot tell whether the source contained three or four characters.

A separate numeric-input check is =BIN2DEC(110), expected to return 6 under Google’s documented valid-number conversion. For import clarity, however, keeping digit representations as explicit text avoids making the column look like ordinary decimal measurements.

Example 2: reconstruct the signed boundary

Enter these full ten-bit strings in D2:D5 as Plain text and use =BIN2DEC(D2) in E2, filling down:

Input Unsigned positional value Signed result
0111111111 511 511
1000000000 512 -512
1111111101 1021 -3
1111111111 1023 -1

For a negative full-width value, subtract 2^10, or 1024, from its unsigned positional value. Thus 1021−1024=−3. This is two’s complement, not a leading minus sign followed by an ordinary positive magnitude.

The shorter string 11111111 remains positive 255. A source that defines an eight-bit signed byte has a different width convention; BIN2DEC’s documented ten-bit format should not silently be substituted for it.

Advanced example: calculate in decimal, then re-encode

Enter the binary strings 11010 and 00110 in G2:H2. They represent decimal 26 and 6. To add their quantities:

=BIN2DEC(G2)+BIN2DEC(H2)

The result is 32. To display that sum as an eight-position binary field, use:

=DEC2BIN(BIN2DEC(G2)+BIN2DEC(H2),8)

The expected representation is 00100000. DEC2BIN converts the decimal result back under its own documented −512 to 511 interval.

Google warns in the DEC2BIN reference that ordinary arithmetic on binary-looking output can silently interpret its digits as decimal. For example, decimal arithmetic on the digit string 11010 plus numeric 6 yields 11016, which is not even valid binary notation. Conversion before arithmetic makes the intended base explicit.

Advanced check: round-trip signed quantities

Enter −3, 0, 21 and 511 in J2:J5. Use =DEC2BIN(J2,10) in K2 and fill down. The expected representations are 1111111101, 0000000000, 0000010101 and 0111111111.

In L2 enter =BIN2DEC(K2) and fill down. The original values −3, 0, 21 and 511 return. This tests the quantity round-trip while making the output width explicit.

The representation round-trip need not preserve a source width: decoding 0000010101 and re-encoding without a requested width follows the converter’s ordinary representation behavior rather than remembering the original characters. Store the width or original string when exact reconstruction matters.

=BIN2DEC("1201") contains the invalid digit 2 and follows Google’s documented #NUM! rule. Do not replace such a failure with zero without also flagging the invalid record; zero is a legitimate binary quantity.

BITAND inspects shared bits after conversion, while BITOR merges masks. These bit operations do not automatically infer that an input’s decimal-looking digits came from a binary file. Native coercion beyond the explicitly documented examples remains untested.

References and verification

Examples use fictional data, English function names and comma separators. Expected outputs are independent mathematical calculations or explicitly documented rules, not native Sheets captures. Check the spreadsheet locale when reproducing punctuation-sensitive formulas.