DEC2BIN Function
DEC2BIN Function

DEC2BIN Function

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.

ExcelClash Team
PUBLISHED

Summary

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.

Purpose

Convert decimal to binary

Turns a base-10 number into base-2 text.

Return value

Binary text

Returns a string made of 1 and 0.

Syntax

=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.

Arguments

  • number - [required] The decimal integer to convert. Excel supports values from -512 to 511.
  • [places] - [optional] The minimum number of binary characters to return for positive values.

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 vs similar functions

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

Using DEC2BIN

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.

Example 1 - Convert 10 to binary

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"
Check Answer
Challenge #1
Target: Sheet1!D1

Convert Decimal 10 to binary.

Example 2 - Pad the result to 8 bits

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"
Check Answer
Challenge #2
Target: Sheet1!D2

Convert 15 to an 8-bit padded binary string.

Example 3 - Convert a negative value

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"
Check Answer
Challenge #3
Target: Sheet1!D3

Convert the negative value to binary.

Example 4 - Convert 252 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"
Check Answer
Challenge #4
Target: Sheet1!D4

Convert octet 252 to binary.

Conclusion Recap

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.

  • Converts decimal to binary: DEC2BIN returns base-2 text from a base-10 number.
  • Supports values from -512 to 511: That is the main numeric range for this function.
  • Places pads positive values: Use it for fixed-width output.
  • Negative values ignore places: Excel returns them as signed 10-bit binary strings.
  • Useful when the bits matter: It is helpful for flags, masks, and fixed-width binary displays.
Tactical Arena
Share DEC2BIN Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.