IP Subnet Host Count Calculator

Work out usable hosts, mask and block size for any IPv4 prefix.

LET’S WORK IT OUT

Your inputs

Results update as you type. Check the units before you begin.

View result ↓
YOUR RESULT
—
Usable hosts
Adjust the inputs

Your result updates live as you type.

An IPv4 prefix of length p leaves 32 − p host bits, giving 2 raised to that power addresses. A /24 therefore holds 256 addresses, of which 254 are usable: the first is the network address and the last is the broadcast address.

Halving the host space each time you add a bit means the usable count drops quickly. A /25 gives 126 hosts, a /26 gives 62 and a /30 gives just 2, which is why /30 became the traditional choice for point-to-point links. RFC 3021 later allowed /31 for that purpose, using both addresses.

Plan for growth before subnetting tightly. Renumbering a live network is far more disruptive than allocating a larger block at the start, and address space inside RFC 1918 private ranges is not scarce.

The formula

usable = 2(32 − prefix) − 2
prefix
Mask length in bits, 0 to 32
32 − prefix
Number of host bits
− 2
Network address and broadcast address
block size
How far apart consecutive subnets sit

How to use this calculator

  1. Set the prefix length with the slider.
  2. Enter how many hosts you actually need.
  3. The gauge shows the usable host count.
  4. Compare the recommended prefix in the results.

Worked examples

The familiar /24

A /24 has 8 host bits, so 256 addresses and 254 usable, with a mask of 255.255.255.0. For 200 required hosts it is the smallest prefix that fits — a /25 would only offer 126.

Sizing a link network

Two routers need two addresses. A /30 provides exactly 2 usable from 4 addresses, wasting half the block, while a /31 provides both of its 2 addresses under RFC 3021. Across a hundred links that saves 200 addresses.

How to read your score

0–30Point to point or tinyLinks, loopbacks and small appliance segments.
30–254Small segmentA single office floor or a VLAN.
254–4,094Medium segmentLarger than is usually wise for one broadcast domain.
4,094–—Large blockSubdivide it rather than deploying it flat.

Frequently asked questions

Why subtract two addresses?

The all-zeros host address identifies the network and the all-ones address is the broadcast address for it. Neither can be assigned to an interface on a normal Ethernet segment.

When is a /31 or /32 valid?

A /31 is valid on point-to-point links under RFC 3021, where there is no broadcast to worry about. A /32 is a single host route, used for loopbacks and for advertising individual addresses.

How large should one broadcast domain be?

In practice a /24 is a comfortable ceiling and a /23 the point at which broadcast and ARP traffic starts to matter. Very large flat networks fail in ways that are hard to diagnose.

What is the wildcard mask for?

It is the inverse of the subnet mask, used in access control lists and routing policy on several vendors platforms. A /24 mask of 255.255.255.0 has a wildcard of 0.0.0.255.

Does IPv6 work the same way?

The arithmetic does, but the scale removes the pressure. A /64 is the standard segment size and holds 2 to the 64th addresses, so nobody counts hosts. Subnetting decisions there are about hierarchy, not capacity.

Prefix lengths and usable hosts

IPv4 prefix, mask and host count
PrefixMaskAddressesUsable hosts
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/28255.255.255.2401614
/30255.255.255.25242
/31255.255.255.25422

A /31 uses both addresses under RFC 3021; a /32 is a single host route.

Related calculators