Calculate the network address, broadcast address, subnet mask, and usable host count from an IPv4 address and CIDR prefix.
Subnetting is the process of dividing a larger IP network into smaller, manageable subnetworks. Given an IPv4 address and a CIDR prefix length (e.g. /24), you can calculate the subnet mask, network address, broadcast address, and the number of usable hosts on that network. The prefix length specifies how many bits of the address are reserved for the network portion; the remaining bits form the host portion. For example, a /24 prefix leaves 8 host bits, giving a network of 256 addresses (254 usable). /31 and /32 prefixes are special cases with no usable hosts (used for point-to-point links or single-host definitions). The wildcard mask is the bitwise inverse of the subnet mask and is commonly used in access control lists (ACLs).
Common questions about IP subnet calculation
A CIDR prefix indicates how many bits of the IP address belong to the network portion. /24 means the first 24 bits of the 32-bit address are the network portion and the remaining 8 bits are the host portion, corresponding to a subnet mask of 255.255.255.0.