Engineering

DEC2BIN Formula

Converts a decimal (base 10) integer to its binary (base 2) representation as a text string. DEC2BIN is essential for engineering, computer science, and networking tasks where you need to see or work with binary representations of numbers, such as IP address subnetting or hardware register analysis.

Syntax

DEC2BIN(number, [places])
ParameterDescription
number Parameter of the DEC2BIN function.
[places] (Optional.) Parameter of the DEC2BIN function.
Try DEC2BIN in Viztab — free, no signup

Examples

Basic conversion

Formula
=DEC2BIN(10)
'1010'. The decimal number 10 equals 1010 in binary (8+2).

With leading zeros

Formula
=DEC2BIN(10, 8)
'00001010'. Pads the result to 8 digits with leading zeros — standard byte representation.

Negative number (two's complement)

Formula
=DEC2BIN(-1)
'1111111111'. Negative numbers are represented in 10-bit two's complement format.

Common Errors

#NUM!

The number is outside the valid range (-512 to 511), or the places argument is too small to hold the result.

#VALUE!

The argument is non-numeric, or places is negative or non-integer.

Tips

Result is text, not a number

DEC2BIN returns a text string, not a number. '1010' is text representing binary, not the decimal one thousand and ten.

Range is -512 to 511

DEC2BIN handles 10-bit signed integers. For larger numbers, you'll need a custom conversion formula or VBA.

Pad to 8 bits for byte display

Use the places argument (=DEC2BIN(n, 8)) to always show 8-digit binary, which is standard for byte-level work.

Try DEC2BIN in Viztab

Import your data and use DEC2BIN with 370+ other formulas. No signup required.

Open Viztab

Related Formulas