Usable Hosts in an IPv4 Subnet
Also known as subnet size · hosts per subnet · CIDR host count · usable addresses · slash 24 hosts · subnet mask hosts
Enter your known values, leave one input blank, and solves for the missing one. Try different units for next level excitement!
Learning zone
An IPv4 prefix of bits leaves bits for hosts, giving addresses, of which two are unusable: the all-zeros address names the network itself and the all-ones address is the broadcast. So a /24 has 254 usable hosts, a /26 has 62, and a /30 has 2, which is why point-to-point links were traditionally /30 and wasted half their space.
The minus two is where the money goes when you subnet. Split a /24 into four /26s and you get usable addresses instead of 254, because each subnet now pays its own network-and-broadcast tax. Split it into sixteen /28s and you are down to . Every additional boundary costs you two addresses, which is invisible on a whiteboard and painfully visible when a /24 will not fit the VLAN plan.
Two exceptions are worth knowing before you trust the formula blindly. RFC 3021 permits a /31 on point-to-point links by dropping the reservation entirely, so a /31 has two usable addresses rather than none, and most modern router platforms support it. A /32 is a single host route, used for loopbacks and for advertising a service address. And the whole thing is an IPv4 story: IPv6 subnets are /64 by convention, which is addresses per LAN, and nobody subtracts two.
- = Usable hosts (hosts)
- = Prefix length (bits)