DEC2BIN function
DEC2BIN converts a decimal number to its binary equivalent and returns it as text, not a number. It turns up in IT, networking and low-level data work.
Example
Read it as a sentence: turn the decimal number 10 into binary, which gives 1010.
A
B
C
D
1
1010
2
3
Syntax
DEC2BIN(number, [places])
Arguments in [square brackets] are optional.
-
number(required) - The whole decimal number to convert, from -512 to 511.
-
places(optional) - Minimum number of characters in the result; pads with leading zeros.
Returns: The binary equivalent.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=DEC2BIN(13) | 1101 | Typical |
=DEC2BIN(-13) | 1111110011 | Negative (two's complement) |
=DEC2BIN(0) | 0 | Zero |
=DEC2BIN({1,2}) | 1 | Spill |
=DEC2BIN(13.9) | 1101 | Decimal 13.9 truncates |
=DEC2BIN("13") | 1101 | Text number |
=DEC2BIN("abc") | #VALUE! | Invalid digit |
=DEC2BIN(1E+15) | #NUM! | Too long input |
Watch out for
- Input is limited to 10 characters.
- Result is text, not a number.
Where it works
- Excel
- DEC2BIN is in every version of Excel from 2007 on.
- Google Sheets
- Same name, same behaviour for everyday use.
Part of Engineering functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .