Convert a CIDR prefix length into its dotted-decimal subnet mask, wildcard mask and usable host count.
A prefix length says how many leading bits belong to the network. Setting those bits to 1 and the rest to 0 gives the subnet mask; inverting it gives the wildcard mask used in ACLs. Two addresses in each block are reserved for the network and broadcast addresses, except /31 (point-to-point) and /32 (host route). Every switch, router, firewall and DHCP scope wants the mask in a different notation, and a mask that is one bit off silently blackholes half a subnet.
Subnet Mask
The mask is the 32-bit value whose leading p bits are 1; usable hosts = 2^(32 − p) − 2.
The mask is the 32-bit value whose leading p bits are 1; usable hosts = 2^(32 − p) − 2. A prefix length says how many leading bits belong to the network. Setting those bits to 1 and the rest to 0 gives the subnet mask; inverting it gives the wildcard mask used in ACLs. Two addresses in each block are reserved for the network and broadcast addresses, except /31 (point-to-point) and /32 (host route).
Every switch, router, firewall and DHCP scope wants the mask in a different notation, and a mask that is one bit off silently blackholes half a subnet.
This calculator takes 1 input: Prefix length (CIDR). The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.