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.

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.

=DEC2BIN(10) // Returns "1010"
Check Answer
Challenge #1
Target: Sheet1!F1
Basic Binary Conversion

Convert Decimal 10 to binary. Formula: =DEC2BIN(10).

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.

=DEC2BIN(15, 8) // Returns "00001111"
Check Answer
Challenge #2
Target: Sheet1!F2
8-Bit Register Padding

Convert 15 to an 8-bit padded binary string. Formula: =DEC2BIN(15, 8).

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 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"
Check Answer
Challenge #3
Target: Sheet1!F3
Negative Signed Binary

Convert -1 to 10-bit Two's Complement. Formula: =DEC2BIN(-1).

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.

=DEC2BIN(252, 8) // Returns "11111100"
Check Answer
Challenge #4
Target: Sheet1!F4
IP Subnet Pattern Check

Convert octet 252 to binary. Formula: =DEC2BIN(252).

Quick recap

  • 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
Select Scenario:
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.