Calc DEC2BIN function

The DEC2BIN function converts a decimal number to its binary equivalent.

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.


Description

The DEC2BIN function converts a decimal number to its binary equivalent. This is useful in various applications, especially in computing and digital electronics, where binary representation is essential.


Syntax

DEC2BIN(number, [places])


The DEC2BIN function syntax has the following arguments:

  • number Required. The decimal number you want to convert to binary. It must be an integer between -512 and 511.
  • places Optional. The number of characters to use for the binary result. If omitted, the function returns the minimum number of characters necessary to represent the number in binary.

Example

FormulaDescriptionResult
=DEC2BIN(10)Converts the decimal number 10 to binary.1010
=DEC2BIN(255)Converts the decimal number 255 to binary.11111111
=DEC2BIN(-5)Converts the decimal number -5 to binary (two's complement representation).11111011
=DEC2BIN(10, 8)Converts the decimal number 10 to binary with at least 8 characters.00001010

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.