Subnet Mask to CIDR

Convert between prefix length and subnet mask, with host counts.

What you provide

Result

/24 = 255.255.255.0 — 254 usable hosts

Usable hosts are two fewer than the total, because the first address is the network and the last is the broadcast.

Mask and wildcard, split at /24

Subnet mask

11111111111111111111111100000000

255.255.255.0 — 1s mark the network

Wildcard mask

00000000000000000000000011111111

0.0.0.255 — the exact inverse, which is what ACLs and OSPF take

  • Network — 24 bits
  • Host — 8 bits
Diagnostic telemetry
Prefix length
/24
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
Total addresses
256
Usable hosts
254

What this cannot tell you

  • Pure arithmetic on the definition of a subnet mask. There is nothing here that can drift or need updating.
  • IPv4 only.

Take this with you

Subnet Mask to CIDR on RunTheTests — free browser-based netmath tools, no sign-up.