Engineering function

BIN2DEC function

Converts binary text such as "1100100" to its decimal value (100). Reads 10-bit inputs that start with 1 as negative numbers.

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

BIN2DEC(number)
ArgumentWhat it means
numberRequiredThe 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).

Returns: A decimal number (which can be negative).

How BIN2DEC works

BIN2DEC reads a string of 0s and 1s and tells you what number it represents in ordinary decimal. It is the reverse of DEC2BIN and is useful when a device, data sheet or log file gives you bit patterns — sensor registers, flag fields, subnet masks — and you want to calculate with them.

The input can be typed as text ("1100100") or as a number (1100100); either works because Excel only looks at the digits. It may be up to 10 characters long. Here is the important gotcha: if the input is exactly 10 characters and starts with 1, Excel treats that first bit as a sign bit and returns a negative number (two's complement). So 1111111111 is -1, not 1023. Shorter strings are always positive.

Inputs longer than 10 characters, or containing any digit other than 0 and 1, return #NUM!. For longer binary strings use DECIMAL (Excel 2013 and later), which accepts up to 255 characters and never treats the first bit as a sign.

Examples

1Read a binary value

B2fx=BIN2DEC(A2)
AB
1Binary
21100100100

Result: 100

1100100 has bits worth 64, 32 and 4 switched on: 64 + 32 + 4 = 100.

2Leading zeros keep it positive

B2fx=BIN2DEC(A2)
AB
110-bit reading
2000010110145

Result: 45

The input is 10 characters but starts with 0, so it is positive: 32 + 8 + 4 + 1 = 45. Note that the value is typed as text — if it were entered as a number Excel would drop the leading zeros, but the result would be the same.

3A 10-bit value starting with 1 is negative

B2fx=BIN2DEC(A2)
AB
1Binary
21000000000-512

Result: -512

Because the input is 10 characters and the first bit is 1, Excel reads it as two's complement: the most negative 10-bit number, -512. If you expected 512, use =DECIMAL(A2, 2) instead.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 15 KB

Common errors and how to fix them

ErrorWhy it happensFix
#NUM!The input has more than 10 characters or contains digits other than 0 and 1.Remove spaces with TRIM or SUBSTITUTE, or use =DECIMAL(A2, 2) for long binary strings.

Tips

  • Binary entered as a number loses leading zeros and is limited by Excel's 15-digit precision; storing it as text (format the column as Text first) is safer.
  • Remove the spaces in grouped binary like 1010 0110 with =BIN2DEC(SUBSTITUTE(A2," ","")).
  • A 10-character binary value that starts with the top digit is negative in two's complement. If you meant a large positive number, it does not fit — use DECIMAL and BASE instead, which work up to 2^53.

Questions

Why does BIN2DEC return a negative number?

A 10-character input starting with 1 is read as a two's-complement negative number. Use DECIMAL(text, 2) if you want it treated as an unsigned value.

What is the largest binary number BIN2DEC accepts?

111111111 (nine 1s), which is 511. Ten characters starting with 1 are negative.

Google Sheets

BIN2DEC also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.

BIN2DEC 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.

LanguageFunction name
DanishBIN.TIL.DEC
DutchBIN.N.DEC
FinnishBINDES
FrenchBINDEC
GermanBININDEZ
HungarianBIN.DEC
ItalianBINARIO.DECIMALE
Norwegian (Bokmål)BINTILDES
PolishDWÓJK.NA.DZIES
Portuguese (Brazil)BINADEC
Portuguese (Portugal)BINADEC
RussianДВ.В.ДЕС
SpanishBIN.A.DEC
SwedishBIN.TILL.DEC