
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.
That makes DEC2BIN a display and interpretation tool rather than a math tool. It is useful when the worksheet needs to show the actual bit structure behind a decimal number, especially in flag checks, masks, and fixed-width binary outputs where the pattern itself carries meaning.
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.
This kind of example is useful when a workbook stores settings or flags as bits. Once the number is shown in binary, it becomes much easier to see which positions are on and which are off.
=DEC2BIN(10) // Returns "1010"
Convert Decimal 10 to binary.
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.
This matters because many technical formats care about length as well as value. The example shows that the number stays the same, but the displayed bit pattern becomes easier to line up with 8-bit fields in reports or exported data.
=DEC2BIN(15, 8) // Returns "00001111"
Convert 15 to an 8-bit padded binary string.
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 one of the most important behavior differences to remember. The example teaches that DEC2BIN is not just adding a minus sign to the front. For negative values, Excel switches to its signed engineering format.
=DEC2BIN(-1) // Returns "1111111111"
Convert the negative value to binary.
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.
That is what makes this example practical. It turns one ordinary number into a bit pattern you can read visually, which is often the whole reason to use DEC2BIN in the first place.
=DEC2BIN(252, 8) // Returns "11111100"
Convert octet 252 to binary.
DEC2BIN is the translation tool to use when a decimal number needs to be shown as a binary pattern. In this lesson, that mattered because the binary view makes flags, masks, and fixed-width bit layouts much easier to inspect than the original decimal value does.
The key idea is that the function returns text, not a number ready for normal arithmetic. For positive values, the optional places argument helps with padded output, while negative values follow Excel's signed 10-bit engineering format instead of that same padding rule.
Tell your friends about this post