Convert a Binary Subnet Mask to Dotted-Decimal Notation

Beginner Calculate

Question

A network diagram shows the binary subnet mask 11111111.11111111.11111100.00000000. Convert this binary mask to its dotted-decimal representation and determine the equivalent CIDR prefix length.

Given

{
  "binary_mask": "11111111.11111111.11111100.00000000"
}

Answer

{
  "decimal_mask": "255.255.252.0",
  "prefix": 22
}

Try to solve it first, then click Reveal Answer

Step-by-Step Explanation

Step 1: Split the binary mask into four octets

11111111 . 11111111 . 11111100 . 00000000
  Oct 1       Oct 2     Oct 3     Oct 4

Step 2: Convert each octet from binary to decimal

Octet 1 — 11111111:

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

Octet 2 — 11111111:

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255

Octet 3 — 11111100:

Bit positions:  128  64  32  16   8   4   2   1
Bit values:       1   1   1   1   1   1   0   0
Decimal:        128 + 64 + 32 + 16 + 8 + 4 = 252

Octet 4 — 00000000:

0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 = 0

Step 3: Assemble dotted-decimal mask

255 . 255 . 252 . 0   →   255.255.252.0

Step 4: Count the prefix length

Count the number of consecutive 1 bits from the left:

11111111.11111111.11111100.00000000
^----- 22 ones -----^

Prefix length = /22

Verification

A /22 covers a block of 2^(32-22) = 2^10 = 1024 addresses, spanning 4 consecutive /24 networks.

Summary

Binary mask 11111111.11111111.11111100.00000000
Decimal mask 255.255.252.0
CIDR prefix /22
Host bits 10
Block size 1024 addresses

Related Terms

More Calculate Worksheets