FormulaCraft

DEC2BIN

DEC2BIN takes a decimal integer (in the range -512 to 511) and returns its binary equivalent as a text string. An optional places argument pads the output with leading zeros to a fixed width, which is useful when building bitfield displays or fixed-width binary representations.

Excel
=DEC2BIN(B2,8)
Google Sheets
=DEC2BIN(B2,8)

Verified example

Computed by a real spreadsheet engine on the sample data below.

DecimalBinary (8-bit)
0
10
42
255

=DEC2BIN(B2,8)00000000

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How it works

  1. 1Enter the decimal integer you want to convert in a cell (must be between -512 and 511).
  2. 2Use =DEC2BIN(number, [places]) — omit places for minimum-width output or specify it for zero-padded output.
  3. 3The result is a text string; use BIN2DEC to convert back.

Need a version for your data?

Try: “Convert the decimal number 42 to binary with 8 digits of zero-padding.

Related

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: