IPv4 to Structural Routing Bits

CIDR is simple: /24 = 256 IPs, minus network and broadcast = 254 usable. /28 = 16 IPs, 14 usable. But what about /19? /11? Put in the prefix length and get the full subnet decomposition. Network engineers have done this math on whiteboards for 30 years. Now you do not have to.

🌐 CIDR Prefix Notation

/24 = 254 usable, not 256. /28 = 14. /19? /11? CIDR prefix in — subnet mask, wildcard, host count out. The math network engineers have scribbled on whiteboards for 30 years. Now you do not have to.

CIDR Subnet Calculation: /24 = 256 IPs, 254 Usable Hosts

CIDR (Classless Inter-Domain Routing) notation is the universal language of IP subnetting, replacing the rigid Class A/B/C system in 1993. A CIDR suffix like /24 means the first 24 bits of the 32-bit IPv4 address are the network prefix, leaving 8 host bits — yielding 28 = 256 total addresses, of which 254 are assignable to hosts (reserving the network address .0 and the broadcast address .255). Every cloud VPC, Kubernetes pod CIDR, and corporate network segment is defined by this simple bit arithmetic.

Common CIDR Prefixes and Their Address Space

CIDRHost BitsTotal IPsUsable HostsSubnet MaskTypical Use Case
/32011 (host route)255.255.255.255Single host routing, loopback
/2841614255.255.255.240Small DMZ subnet, VPN endpoint pool
/248256254255.255.255.0Standard VPC subnet, office LAN
/161665,53665,534255.255.0.0Large corporate network, VPC CIDR block
/82416,777,21616,777,214255.0.0.0Legacy Class A, AWS VPC maximum
/0324,294,967,296N/A0.0.0.0Default route (0.0.0.0/0)

Network and Broadcast Addresses

In any subnet larger than /31, two addresses are reserved and cannot be assigned to hosts: the network address (all host bits set to 0) identifies the subnet itself, and the broadcast address (all host bits set to 1) targets every host on the subnet simultaneously. This is why a /24 subnet has 256 mathematically possible addresses but only 254 are usable. Modern point-to-point links often use /31 subnets (RFC 3021) which have no network or broadcast reservation, yielding 2 usable addresses from 2 total IPs.

Wildcard Masks for ACL and Routing Configuration

The wildcard mask is the bitwise complement of the subnet mask — every 0 in the subnet mask becomes 255 in the wildcard, and vice versa. Cisco ACLs and OSPF routing configurations use wildcard masks to specify which bits of an address must match (subnet mask bits) and which bits are ignored (wildcard bits). For a /24 subnet, the subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. Cisco ACLs, OSPF network statements, and BGP route filters all use wildcard masks. If you have ever typed `network 10.0.0.0 0.0.255.255 area 0` into a router, you know this math cold.