RunTheTests

Subnet Mask to CIDR

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

System verdict

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.

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.

How this calculation works

A subnet mask is simply a run of ones followed by a run of zeros: the prefix length says how many ones. This tool converts either form to the other and counts the hosts, using the definition directly rather than a lookup table, so any prefix from /0 to /32 works.

What the results mean

Wildcard mask
The inverse of the subnet mask, used by Cisco access lists and some routing configurations.
Usable hosts
Two fewer than the total for /30 and larger, because the network and broadcast addresses are reserved. A /31 and /32 are the exceptions.

Frequently asked questions

Why does a /24 give 254 hosts, not 256?

The first address identifies the network and the last is the broadcast, and neither can be assigned to a device. So 256 total addresses leave 254 usable.

Is 255.255.255.0 the same as /24?

Yes. That mask is 24 ones followed by 8 zeros, which is exactly what /24 means. Enter either form above to see the other.

More in NetMath