How to Convert Decimal to Binary with DEC2BIN in Excel
Write the octets of an IP address in binary, pad them to 8 bits, and build the full dotted binary address.
You will learn to
- Convert a decimal number to binary
- Pad binary output to a fixed width
- Join several conversions into one string
How it works
DEC2BIN(number, [places]) converts a decimal integer to binary text: =DEC2BIN(192) returns 11000000. The optional places argument pads with leading zeros, so =DEC2BIN(77,8) returns 01001101 — handy for 8-bit values such as IP address octets.
DEC2BIN accepts numbers from −512 to 511; negatives come back as 10-bit two’s complement. Because the result is text, you can join several conversions with & to build strings like a full binary IP address.
=DEC2BIN(B2,8)