Hosts per Subnet Calculator
How many usable hosts fit in a /24, /26 or /30? Look up any IPv4 prefix (or subnet mask) to see its total and usable addresses, and scan the full reference table from /0 to /32. Runs locally in your browser.
Reference: hosts per IPv4 prefix
| CIDR | Subnet mask | Total addresses | Usable hosts | Notes |
|---|
Counting hosts in a subnet
An IPv4 subnet is described by a prefix length โ the /24 in 192.168.1.0/24 โ which says how many leading bits are fixed as the network portion. The remaining bits are free to number hosts. With a prefix of p, there are 32 โ p host bits, giving 2(32โp) total addresses in the block.
Not all of those are assignable. In an ordinary subnet the first address is the network address and the last is the broadcast address, so the usable host count is 2(32โp) โ 2. That is why a /24 holds 256 addresses but only 254 usable hosts, and a /26 holds 64 but 62.
A /30 gives 2 usable hosts and is the classic choice for a point-to-point link. A /31 has only 2 addresses total; under RFC 3021 both are usable on a point-to-point link, so it also provides 2 hosts with no waste. A /32 is a single address โ one host โ used for loopbacks and host routes.
Using the table
The reference above lists every prefix from /0 to /32 with its dotted mask, total addresses and usable hosts. It is the fastest way to answer "which prefix gives me at least N hosts?" without doing the powers of two in your head. Enter a prefix or a mask in the box and the matching row is highlighted with a quick summary.
To understand where the mask comes from, see what is a subnet mask, and for the bigger picture start with what is an IP address. When you need to plan several differently sized subnets, the VLSM Calculator allocates them for you, and the Subnet Calculator breaks down any single IP and prefix. Everything here is computed in your browser โ nothing is uploaded.
Frequently asked questions
How many usable hosts are in a /24?
A /24 has 256 total addresses and 254 usable hosts, because the network address and the broadcast address are reserved and cannot be assigned to a device.
Why subtract 2 from the total addresses?
In a normal subnet the first address is the network identifier and the last is the broadcast address. Neither can be given to a host, so usable hosts equal total addresses minus 2.
How many hosts are in a /30 and a /31?
A /30 has 4 addresses and 2 usable hosts, common for point-to-point links. A /31 has just 2 addresses; under RFC 3021 both are usable on a point-to-point link, so a /31 also gives 2 usable hosts.
What about a /32?
A /32 describes a single address โ exactly 1 host โ used for host routes, loopbacks and pointing at one specific machine.
Want the theory? Read the guides โ ยท Visit the zoo โ