
Convert decimal numbers to binary text in Excel. Useful for bit patterns, masks, and any case where you need to see a number in base 2.
DEC2BIN converts a decimal number into binary text. If you have a normal base-10 value and want to see its base-2 bit pattern, this is the function to use.
This is useful when the bit pattern matters more than the decimal number itself. It comes up in status flags, masks, fixed-width fields, and any workflow where you need to see exactly which bits are on or off.
Turns a base-10 number into base-2 text.
Returns a string made of 1 and 0.
=DEC2BIN(number, [places])
number is the decimal value to convert. places is optional and pads positive results with leading zeros.
The main value is the converted binary text. If you need a fixed-width result, add places. If you leave it out, Excel uses the shortest binary form it can. Negative values follow the signed 10-bit engineering format instead of normal left-padding.
number has to be a whole number in the supported range. places is only for positive results and is best used when the output needs to match a fixed field such as 8 bits or 10 bits. If the converted value will not fit inside the places value you provide, Excel returns #NUM!.
DEC2BIN is the right choice when the output needs to be a visible bit pattern:
| Function | What it does | Typical use | Result |
|---|---|---|---|
DEC2BIN |
Converts decimal to binary | Flags, masks, and bit display | Binary text |
BIN2DEC |
Converts binary to decimal | Turn bits back into a number | Number |
DEC2HEX |
Converts decimal to hex | Compact technical formatting | Hex text |
DEC2OCT |
Converts decimal to octal | Legacy or base-8 formatting | Octal text |
The simplest use is taking a decimal value and showing the bit pattern behind it. That makes it much easier to inspect masks, flags, or fixed-width binary fields than trying to reason from the decimal value alone.
The places argument lets you pad positive results with leading zeros. For example, 15 becomes 1111 by default, but with 8 places it becomes 00001111. If the result needs more characters than the places value allows, Excel returns #NUM!.
Negative values use the signed format built into these engineering functions. Excel returns them as full 10-bit binary strings and ignores places, which is why DEC2BIN(-1) returns 1111111111.
This is the simplest use of DEC2BIN: take an ordinary decimal integer and expose the bit pattern behind it. Excel returns 1010, which makes it easier to reason about individual bit positions than the decimal value 10 alone.
=DEC2BIN(10) // Returns "1010"
Convert Decimal 10 to binary. Formula: =DEC2BIN(10).
The places argument matters when the output has to match a fixed-width field such as a byte. Without padding, 15 becomes 1111. With 8 places, Excel returns 00001111, which preserves the same value while making the length suitable for register-style or mask-style work.
=DEC2BIN(15, 8) // Returns "00001111"
Convert 15 to an 8-bit padded binary string. Formula: =DEC2BIN(15, 8).
Negative numbers are not padded in the same way as positive ones. Instead, Excel returns a signed 10-bit binary result, so -1 becomes 1111111111. This is useful when the workbook needs to represent signed values in the same fixed-width format used by Excel's engineering conversion functions.
=DEC2BIN(-1) // Returns "1111111111"
Convert -1 to 10-bit Two's Complement. Formula: =DEC2BIN(-1).
The value 252 becomes 11111100, which is much more informative if you are inspecting a mask or fixed network-style pattern. In decimal, the structure of the value is hidden. In binary, you can immediately see which low-order bits are clear and which higher bits are set.
=DEC2BIN(252, 8) // Returns "11111100"
Convert octet 252 to binary. Formula: =DEC2BIN(252).
Tell your friends about this post