DEC2BIN Function

Excel 2007+, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 365

Summary

The Excel DEC2BIN function converts decimal integers to their binary representation. It handles both positive numbers (0 to 511) and negative numbers (-512 to -1) using two's complement notation for negatives.

Syntax

DEC2BIN(number, [places])

Parameters

Parameter Type Required Description
number Number Yes The decimal integer you want to convert to binary. Range: -512 to 511.
places Number No Optional. Number of characters to use in the binary result. Pads with leading zeros if needed.

Using the DEC2BIN Function

DEC2BIN is perfect for converting decimal values to binary format, especially useful in computer science education, digital electronics, programming, and when working with binary data in spreadsheets. Use it to visualize bit patterns or perform binary calculations.

Common DEC2BIN Examples

Convert Positive Decimal to Binary

=DEC2BIN(9, 4)

Converts 9 to 4-digit binary: 1001

Convert Negative Decimal

=DEC2BIN(-100)

Converts -100 to 10-bit two's complement binary: 1110011100

Automatic Length Binary

=DEC2BIN(255)

Converts 255 to shortest binary: 11111111

Frequently Asked Questions

Numbers from -512 to 511. Positive: 0-511 (9 bits), Negative: -512 to -1 (10 bits with sign).

It pads the binary result with leading zeros to reach the specified length.

Using 10-bit two's complement notation where the most significant bit is the sign bit.

Common Errors and Solutions

#NUM!

Cause: Number outside range (-512 to 511)

Solution: Use value between -512 and 511

#NUM!

Cause: Result needs more characters than places allows

Solution: Increase places or omit it

#VALUE!

Cause: Non-numeric input

Solution: Ensure number and places are numeric

#NUM!

Cause: Places is zero or negative

Solution: Use positive integer for places

Notes

  • Maximum 10-bit output for negative numbers
  • Places parameter truncates non-integer values
  • Omit places for minimum length binary
  • Two's complement for negative numbers

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 365

Not available in: Excel 2003 and earlier

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 365