Host Count Calculator
Calculate the number of usable host addresses available in a subnet.
About Host Count Calculator
Every IPv4 subnet of prefix length p contains 2^(32−p) total addresses. Of these, the first is the network address and the last is the broadcast address, neither of which can be assigned to a host — so usable hosts = 2^(32−p) − 2. The exceptions are /31 (RFC 3021 point-to-point links, both addresses usable) and /32 (a single host route).
Formula
Total and usable hosts
total = 2^(32 − prefix); usable = total − 2
- p
- CIDR prefix length
Worked example
With the default values below, Host Count Calculator returns Usable Hosts of 254. Change any input above and every figure here is recalculated in your browser.
Inputs used
- CIDR Prefixaccepts 0–32 /
- 24 /
Results
- Usable Hosts
- 254
- Total Addresses
- 256
- Subnet Mask
- 255.255.255.0
- Note
- Network and broadcast addresses excluded.
Step by step
- 1Values used
- 2Total and usable hosts
- 3Usable Hosts= 254
- 4Total Addresses= 256
- 5Subnet Mask= 255.255.255.0
- 6Note= Network and broadcast addresses excluded.
Assumptions and limits
- The result is derived only from the single input listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why subtract 2 from the total address count?
One address in every subnet is reserved as the network identifier and one as the broadcast address for that subnet, so they cannot be assigned to hosts.
How many usable hosts does a /24 have?
A /24 has 2^(32−24) = 256 total addresses, minus 2 reserved addresses, giving 254 usable hosts.
What's special about /31 and /32?
A /32 has only one address and identifies a single host (a 'host route'). A /31, per RFC 3021, is defined so both of its two addresses can be used as endpoints of a point-to-point link, since there's no room for separate network/broadcast addresses.
