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
Units aren’t used in this calculation — every value is a plain number.
Worked example: a /24 → 254 usable hosts — press Try an example to run it live, then adjust anything.
Enter your known values, leave one input blank, and solves for the missing one. Tap a variable’s symbol to see what it means, with a typical value.
Usable Hosts in an IPv4 Subnet explained
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 in an IPv4 Subnet formula
- = Usable hosts (hosts)
- = Prefix length (bits)
Missing one of these? Work it out first, then come back
- Usable hosts — RSA Modulus, RSA Totient
- Prefix length — RSA Modulus, RSA Totient