CIDR Host Count Calculator

Enter a CIDR prefix length to count usable hosts.

How it is calculated

Only the prefix length is needed. Total addresses: 2^(32 - prefix). Usable hosts: 2^(32 - prefix) - 2, because the first address (network) and the last (broadcast) cannot be given to a device. The subnet mask is the prefix written as 32 bits, with prefix ones followed by zeros, then split into four decimal octets.

Two special cases are built in. A /31 reports 2 usable hosts, following the point-to-point rule where no network or broadcast address is reserved. A /32 reports 1, a single host. Everything from /0 to /30 follows the general formula. Enter a whole number from 0 to 32, without the slash: a decimal, a value above 32, or text such as "/24" returns no result. The tool counts addresses in a block; it does not know which of them your network already uses.

Worked example

You want to know what a /27 gives you. There are 32 - 27 = 5 host bits, so the block holds 2^5 = 32 addresses in total. Subtract the network and broadcast addresses: 32 - 2 = 30 hosts are usable. The mask has 27 one-bits: the first three octets are 255 each, and the last octet has three one-bits (128 + 64 + 32 = 224), so the tool shows 255.255.255.224. A /27 therefore suits a network of up to 30 devices.

Try this example →

Common mistakes

  • Typing /27 with the slash. The field takes the plain number 27 and returns nothing for "/27".
  • Reporting 32 addresses as 32 hosts. For prefixes up to /30, two addresses are reserved, so the usable count is always total minus two.
  • Choosing a subnet that exactly fits today's device count. A network of 30 devices on a /27 has no room to grow, and gateways and other infrastructure also use host addresses.
  • Mixing up the direction of the prefix. A larger prefix means a smaller block: /28 holds 16 addresses, /24 holds 256.
  • Expecting /31 to follow the minus-two rule. It gives 2 usable hosts for point-to-point links, and /32 gives 1.

About this calculator

CIDR notation writes an IPv4 subnet as an address followed by a slash and a prefix length (e.g. /24) that tells you how many of the 32 address bits are fixed for the network, leaving the rest for hosts. The block holds 2^(32−prefix) total addresses, but two of those — the network address and the broadcast address — can’t be assigned to a device, so usable hosts equal 2^(32−prefix) − 2 (a /31 or /32 is a special case with no such reservation).

The same prefix length also corresponds to a dotted-decimal subnet mask (a /24 is 255.255.255.0, a /27 is 255.255.255.224, and so on), which routers and operating systems actually use to decide which addresses share a network. Network engineers and system administrators use this conversion constantly when carving a larger network into subnets, sizing a subnet for a given number of devices, or documenting a VLAN’s addressing plan.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The count is the pure IPv4 maths, but some platforms hold back more addresses than the network and broadcast pair. Amazon's VPC subnets and Azure subnets each reserve five, so a /28 that shows 14 usable hosts here gives 11 usable addresses on those clouds. Check your provider's documentation before sizing a subnet tightly, and leave room to grow. Which platform or equipment do you plan subnets for?

Popular calculators

All Calculators