Skip to content
Calcrivo

Host Count Calculator

Find the total and usable host addresses available for any CIDR prefix length.

Inputs

/

Usable Hosts

254

Total Addresses

256

Subnet Mask

255.255.255.0

Note

Network and broadcast addresses excluded.

Step by step

  1. Values used

    CIDR Prefix = 24 /

  2. Total and usable hosts

    total = 2^(32 − prefix); usable = total − 2

  3. Usable Hosts

    = 254

  4. Total Addresses

    = 256

  5. Subnet Mask

    = 255.255.255.0

  6. Note

    = Network and broadcast addresses excluded.

How it works

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

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.

You might also need