All guides

How Many Hosts Fit in a Subnet? The Minus Two Rule

Why two addresses are always missing

Every subnet keeps its first and last addresses for itself. The first, with all device bits zero, is the network address: it names the subnet and cannot be given to a device. The last, with all device bits one, is the broadcast address, used to speak to every device at once. So the usable host count is the total addresses minus two. A /24 has 2 to the power 8, which is 256 addresses, and 254 usable hosts. A /25 halves that to 128 addresses and 126 hosts. This minus two surprises people the first time a tidy 256 turns out to seat 254, and it is the single most asked question in networking classes.

The doubling ladder

Each step of prefix length halves or doubles the subnet. Commit the ladder to memory and most sizing questions answer themselves: /30 has 4 addresses and 2 hosts, /29 has 8 and 6, /28 has 16 and 14, /27 has 32 and 30, /26 has 64 and 62, /25 has 128 and 126, /24 has 256 and 254, /23 has 512 and 510, /22 has 1024 and 1022. To size a subnet for a known number of devices, climb the ladder until the host count fits, then add headroom for growth, printers, and the address the router itself takes. Sizing exactly to today's count is the classic false economy, because renumbering a network later is tedious and error prone.

The edge cases that break the rule

Two prefixes break the pattern. A /32 is a single address with no network or broadcast waste; it names one host and is used in routing and firewall rules. A /31 has two addresses and by the classic rule zero usable hosts, which made it useless until a standard called RFC 3021 allowed both addresses on point to point links to be used, since a link with exactly two ends needs no broadcast. Many home users meet the ladder from the other side: their router gives them a /24, and everything fits. The subnet calculator here applies the classic rule and labels the special cases, so the host counts it shows match what exams, documentation and most equipment expect. A note for the home reader: your router almost certainly runs a /24, and its DHCP pool is usually a slice of that, perhaps addresses 100 to 199, leaving the rest for devices you number by hand, like printers and servers. That design is the ladder from this guide in everyday clothes. When a device refuses to join or two devices argue over an address, you are watching host counting go wrong in miniature, and the fix starts with knowing how many seats the subnet actually has.

Try the calculator

The free tool that goes with this guide:

Calculate a subnet