CIDR & masks — common questions
How do I convert a CIDR prefix to a subnet mask?
The prefix is the number of leading 1-bits in the mask. /24 = 24 ones = 255.255.255.0; /26 = 255.255.255.192; /30 = 255.255.255.252. The table on this page lists every prefix from /0 to /32 with its mask, wildcard, usable hosts and total addresses — or use the live subnet calculator to convert a specific address.
Why does /31 show 2 usable hosts and /32 show 1?
A /31 is reserved for point-to-point links (RFC 3021), where both of the two addresses are usable — there is no network or broadcast address to subtract. A /32 is a single-host route (one address). Every other prefix subtracts the network and broadcast addresses, so usable = total − 2.
What is the wildcard mask used for?
The wildcard mask is the inverse of the subnet mask and is used in Cisco ACLs and OSPF to match address ranges. /24 has wildcard 0.0.0.255. The table includes the wildcard for every prefix.