How it works
A subnet mask splits an IPv4 address into a network part (the leftmost prefix bits) and a host part (the remaining bits). The CIDR prefix is simply how many bits are set to 1 in the mask.
Usable hosts per subnet = 2^(32 − prefix) − 2. The −2 removes the network address (all host bits 0) and the broadcast address (all host bits 1).
- Network address — the address with every host bit set to 0; it names the subnet itself.
- Broadcast address — every host bit set to 1; packets to it reach all hosts on the subnet.
- Wildcard mask — the bitwise inverse of the subnet mask, used in Cisco ACLs and OSPF.
- First / last usable — network + 1 through broadcast − 1, the addresses you can actually assign.
The /31 and /32 edge cases
The − 2 rule has two exceptions this calculator handles:
- /31 — RFC 3021 allows both addresses to be used on point-to-point links, so a /31 has 2 usable hosts, not 0.
- /32 — a single host route (one address), commonly used for loopbacks and host-specific rules.
Private (RFC 1918) ranges
| Range | CIDR |
|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
The calculator also flags 127.0.0.0/8 (loopback) and 169.254.0.0/16 (APIPA / link-local) when relevant.