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
| CIDR | Host Bits | Total IPs | Usable Hosts | Subnet Mask | Typical Use Case |
|---|---|---|---|---|---|
| /32 | 0 | 1 | 1 (host route) | 255.255.255.255 | Single host routing, loopback |
| /28 | 4 | 16 | 14 | 255.255.255.240 | Small DMZ subnet, VPN endpoint pool |
| /24 | 8 | 256 | 254 | 255.255.255.0 | Standard VPC subnet, office LAN |
| /16 | 16 | 65,536 | 65,534 | 255.255.0.0 | Large corporate network, VPC CIDR block |
| /8 | 24 | 16,777,216 | 16,777,214 | 255.0.0.0 | Legacy Class A, AWS VPC maximum |
| /0 | 32 | 4,294,967,296 | N/A | 0.0.0.0 | Default 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.