# Documentation/Calc Functions/BIN2DEC

TDF LibreOffice Document Liberation Project Community Blogs Weblate Nextcloud Redmine Ask LibreOffice Donate

## Function name:

BIN2DEC

## Category:

Add-in

## Summary:

Converts a binary number (base-2) to its decimal (base-10) equivalent. The input binary number must correspond to a decimal number *d* in the range -512 ≤ *d* < +511.

## Syntax:

BIN2DEC(**Number**)

## Returns:

Returns an integer number in the range -512 ≤ *d* < +511, which is the decimal value that corresponds to the specified binary number.

## Arguments:

**Number** is a string or a number, or a reference to a cell containing one of those types, which gives the binary number that is to be converted to decimal. The binary number must comprise only the digits 0 and 1, and must be no more than 10 digits long.

**Number**should use the standard two's complement representation. In two's complement, positive numbers are binary 0 to 111111111 (0 to 511 decimal) and negative numbers are binary 1111111111 to 1000000000 (-1 to -512 decimal). Negative numbers must be ten digits long with the left-most digit set to 1; positive numbers can comprise less than 10 digits.- If
**Number**does not specify a valid binary number, then BIN2DEC reports an invalid argument error (Err:502). This may arise, for example, if**Number**contains more than 10 characters or if it contains any character other than the digits 0 and 1. - If
**Number**is a string comprising no characters, or a reference to an empty cell, BIN2DEC returns 0. - Although the content of
**Number**appears to be binary, it is not. However, BIN2DEC will interpret it correctly.

## Additional details:

The following Wikipedia pages provide useful background information relevant to this function:

## Examples:

Formula | Description | Returns |
---|---|---|

=BIN2DEC(1111) | Here the function converts the binary value of 1111 (passed as a number) to its decimal equivalent of 15. | 15 |

=BIN2DEC("1111") | Here the function again converts the binary value of 1111 (passed as a string on this occasion) to its decimal equivalent of 15. | 15 |

=BIN2DEC(D1) where cell D1 contains the number 1111. | Here the function again converts the binary value of 1111 (passed via a cell reference on this occasion) to its decimal equivalent of 15. | 15 |

=BIN2DEC(1000000000) | Here the function converts the 10-character binary value of 1000000000 to its decimal equivalent of -512. | -512 |

=BIN2DEC(1111111111) | Here the function converts the 10-character binary value of 1111111111 to its decimal equivalent of -1. | -1 |

=BIN2DEC(111111111) | Here the function converts the 9-character binary value of 111111111 to its decimal equivalent of 511. | 511 |

## Related LibreOffice functions:

## ODF standard:

## Equivalent Excel functions:

BIN2DEC