Usable Host Count Calculator: CIDR Prefix to Hosts and Subnet Sizing

Usable Host Count Calculator

Turn any CIDR prefix into the number of usable hosts with usable = 2^(32 - prefix) - 2, or work backward from a required host count to the smallest subnet that fits. Handles the reserved network and broadcast addresses, the RFC 3021 /31 point-to-point link, and the single-address /32, and reports address utilization so you can size subnets without wasting space.

📡Choose a Mode

🎯Common Subnet Presets

📝Subnet Inputs

The mask bits after the slash, for example 24 for a /24.

How many devices need an address on this subnet.

Extra capacity added on top of your host count before sizing.

Standard subnets reserve the first and last address.

This tool sizes IPv4 host space with a 32-bit width.

Gateway or infrastructure addresses to hold back from hosts.

Usable hosts 0 addressable devices
Total addresses 0 block size 2^host bits
Recommended prefix /0 smallest block that fits
Address utilization 0% wasted 0 addresses

🔱Formula Snapshot

h32 - prefix
2^htotal addresses
2^h-2usable hosts
/312 usable rfc3021

📋Prefix to Usable Hosts Chart

CIDR PrefixHost BitsTotal AddressesUsable HostsReads As
/248256254Class C sized
/257128126Half of /24
/2666462Quarter /24
/2753230Eighth /24
/2841614Sixteen block
/29386Eight block
/30242Router link
/31122RFC 3021 P2P
/32011Single host

📊Host Requirement to Smallest Subnet

Hosts NeededSmallest PrefixUsable HostsTotal AddressesSpare Hosts
1/32110
2/30240
5/29681
10/2814164
25/2730325
50/26626412
100/2512612826
200/2425425654
500/2351051210
1000/221022102422

🧼Power-of-Two Host Blocks

Host BitsBlock Size 2^hPrefixUsable 2^h - 2Doubling Note
01/321 (single)One address
12/312 (RFC 3021)Point to point
24/302Doubles to 4
38/296Doubles to 8
416/2814Doubles to 16
532/2730Doubles to 32
664/2662Doubles to 64
8256/24254Full octet

🗃Subnet Size Comparison Grid

PrefixTotal AddressesUsable HostsTypical UseFits 50 HostsWasted If 50 Used
/24256254Standard LAN or VLANYes204 spare
/25128126Split LAN halfYes76 spare
/266462Department subnetYes12 spare
/273230Small workgroupNoToo small
/281614Server rack or labNoToo small
/2986DMZ or edge blockNoToo small
/3042Router to router linkNoToo small
/3122P2P link RFC 3021NoToo small

⚙Formula Breakdown

Host bits h = 32 - prefixEvery bit not in the network prefix is a host bit. A /26 has h = 32 - 26 = 6 host bits available for addressing.
Total addresses = 2^hThe block holds 2 raised to the host bits. With 6 host bits that is 2^6 = 64 total addresses in the /26 block.
Usable hosts = 2^h - 2Subtract the network and broadcast addresses. A /26 gives 64 - 2 = 62 usable host addresses for devices.
/31 exception = 2 usableRFC 3021 removes the reserved pair on point-to-point links, so a /31 offers 2 usable addresses instead of zero.
/32 host = 1 addressA /32 is a single host route, common for loopbacks and host-specific rules. It counts as 1 usable address.
Reverse sizing h = ceil(log2(need + 2))To fit 50 hosts, need + 2 = 52, log2 rounds up to 6 host bits, giving a /26 as the smallest subnet.
Utilization = need / usable x 10050 required hosts in a 62-host /26 is 50 / 62 = 80.6 percent utilization, leaving 12 addresses spare.

💡Host Sizing Tips

Always round up to a power of two: Subnets only come in sizes of 2, 4, 8, 16 and so on. If you need 50 hosts, a /27 gives just 30 usable and falls short, so you must jump to a /26 with 62 usable. Sizing to the exact count is impossible; pick the next block up and accept the spare addresses as headroom.
Do not forget the reserved two: A naive count of 2^h overstates capacity by exactly two addresses on any subnet /30 or larger. A /24 looks like 256 addresses but only 254 host a device, because .0 is the network and .255 is the broadcast. Plan around usable = 2^h - 2, not the raw block size.

Or perhaps you’ve got an apparently good network plan on paper, yet when you attempt to assign those addresses, nothing seem available. You’ve got plenty of room for all your gear, but too many holes and you end up with a puzzle-like mess rather than a well-structured addressing hierarchy. IPv4 planning creates some friction. It does not happen often enough to cause a system crash, but it is enough to slow down everything from VLAN assignments to router configurations.

This happens because of the powers-of-two math versus our tendency to think in linear increments. IPv4 has a bit length of thirty-two, and the CIDR prefix describe how many bits describe the network and how many bits remain for hosts. Two to the power of eight (the number of host bits if you’re given a /24) is two hundred fifty-six. A /24 provide two hundred fifty-six total addresses.

Why IPv4 Planning Is Hard

Where most folks fall down is remembering that two of those addresses have to be reserved: one for the network address itself and one for the broadcast address. Neither of these can contain a device; so while there’s room in the block for two hundred fifty-six, you can realy use only two hundred fifty-four of them for printers or servers. That slight math change occur when you start putting host into smaller subnets. It’s good that the calculator does this math for us on the fly, no mistakes here! But it’s better if we understand *why* these numbers change.

Remember, you can’t pick any subnet size at random. Binary addressing require blocks of two (32), four (30), eight (28) or sixteen (26). For example, suppose I want 42 hosts? A /26 provides 64 IP addresses in all, giving me 62 usable ones (after taking away the network and broadcast address). A /27 provide only 30 usable hosts, leaving me stuck with 12 devices that don’t fit into my plan. That is, I can’t reduce the block any smaller without falling below my host count. So take the /26 and deal with those spare 20 IP addresses.

That additional overhead (the “wasted” addresses) isn’t a bug but an efficiency of binary logic: a safety valve for static allocations such as gateway addresses, or space to grow as needed. The tool helps you account for that growth. Add a percentage margin first and then the tool tells you the smallest subnet that will still fit. This prevents painful renumbering later if you failed to plan for growth. It turns abstract waste into a clear strategy: you’re not wasting any addresses at all; you’re buying yourself insurance against change.

Another complication in the rules is that there are exceptions: In the old days, a /30 had just two available IP addresses of four (with overhead due to the link being used as a point-to-point connection between routers). For those kinds of links, /31s are legal according to RFC 3021, meaning you can use both IPs in a /31 where there isn’t an actual “broadcast” or “network” address. That’s twice as efficient on a router link, though at the other end of the spectrum a /32 is simply one host, good for a loopback or a special firewall rule. Knowing what works with your gear is as important than knowing when to use these exceptions.

This means it’s frequently easier to work backwards; if you know the prefix, then you have a known quantity of hosts. But if you don’t start with the host count, you have to round up to the nearest power-of-two. This reverse sizing mode inverts that process to tell you exactly what subnet will fit your needs while not wasting extra addresses. It displays the use rate, so you can see at a glance just how many of those addresses are actualy in use as opposed to unused. That rate allows you to weigh the tradeoff between saving address space vs reserving room for growth.

These relationships is laid out in clear reference tables included with the tool, which map common numbers of hosts to their corresponding minimum subnet size. Over time, this visual aid builds intuition; it becomes obvious at-a-glance that five hosts push you into a /29 while twenty-five will require a /27. Soon enough, you don’t need to calculate anymore, you recognize patterns (a server rack with ten machines fits in a /28; a department with fifty people requires a /26).

Learning this math will make network design far more predictable, the guesswork goes out and address planning becomes a mathematical exercise rather than drudgery. Instead of dreading constraints of the base-2 math, you can use it to build out a logical network in the most efficient way possible, where subnets aren’t “filled” but they have headroom when looked at on paper. It’s the difference between a chaotic network and one which will scale smoothly over time.

Usable Host Count Calculator: CIDR Prefix to Hosts and Subnet Sizing