How to calculate how many hosts a subnet needs
SubnettingCIDRLevel: Beginner

How Many Hosts Does a Subnet Need? (Without Getting Confused)

The simple way to go from “I need X devices” to the right prefix without memorizing giant tables. Hosts + 2, powers of two, common examples, and a quick checklist.

CIDR → HostsFLSM methodSubnetting guide

The key idea

There is one part of subnetting that seems trivial until you realize it is where many exercises go wrong: how many hosts does a subnet actually need?

If you estimate the host requirement incorrectly, you choose the wrong block size, which means the prefix will be wrong too. And once the prefix is wrong, everything else—increment, ranges, broadcast—falls apart after it.

The good news: you do not need to memorize huge tables. You only need one rule and one pattern.

Hosts vs addresses: they are not the same thing

In typical IPv4 exercises, a subnet contains an address block, and inside that block you have:

  • Network: the first address, which identifies the subnet
  • Broadcast: the last address, used for broadcast
  • Hosts: the usable addresses in between
Practical rule: usable hosts ≈ addresses in the block − 2 (network and broadcast).

So when someone says “I need 50 hosts,” what you should actually think is: “I need a block with enough addresses for 50 hosts plus 2 reserved addresses.”

Quick method: hosts + 2 and the smallest power of two

This is the workflow that saves you in an exam and keeps you from guessing:

  1. Take the host count you need as usable addresses.
  2. Add 2 for network + broadcast.
  3. Find the smallest power of two that can cover that number.
  4. That power of two is your block size, meaning total addresses.
  5. Use the block size to determine the prefix.
IPv4 divides cleanly into blocks of size 2ⁿ: 4, 8, 16, 32, 64, 128, 256… You will never get a block of exactly “52.”

Quick example: 50 hosts

  • 50 + 2 = 52 required addresses
  • Smallest power ≥ 52 → 64
  • Block size 64 → usable hosts 64 − 2 = 62
If you need 50 hosts, the correct block size is 64, which means the prefix is /26.

How to turn a block size into a prefix without memorizing

IPv4 has 32 bits. If your block contains 64 addresses:

  • 64 = 2⁶ ⇒ you need 6 host bits
  • Prefix = 32 − 6 = /26
block = 2^h
host_bits = h
prefix = 32 - h
Mental shortcut: if the block is 128 → 2⁷ → /25. If the block is 32 → 2⁵ → /27. It is always the same pattern.

A useful mental table

You do not need to memorize everything, but these ranges cover most common exercises:

Hosts needed (approx.)Block (addresses)Usable hostsPrefix
up to 242/30
up to 686/29
up to 141614/28
up to 303230/27
up to 626462/26
up to 126128126/25
up to 254256254/24
Shortcut: 50 hosts falls between 30 and 62 → /26. 100 hosts falls between 62 and 126 → /25.

Common examples to master the pattern

Example A: I need 12 hosts

  • 12 + 2 = 14
  • Smallest power ≥ 14 → 16
  • 16 = 2⁴ ⇒ prefix = 32 − 4 = /28
  • Usable hosts = 16 − 2 = 14

Example B: I need 100 hosts

  • 100 + 2 = 102
  • Smallest power ≥ 102 → 128
  • 128 = 2⁷ ⇒ prefix = 32 − 7 = /25
  • Usable hosts = 128 − 2 = 126

Example C: I need 2 hosts for a typical point-to-point link

  • 2 + 2 = 4
  • Smallest block = 4
  • 4 = 2² ⇒ prefix = 32 − 2 = /30
  • Usable hosts = 2
Real networks can use /31 in some cases, but learning exercises and exams often expect /30.

Common mistakes when estimating hosts

Forgetting network and broadcast

If you need 30 hosts and choose a block of 30 “because it fits,” you are already off track: block sizes follow powers of two, and two addresses are reserved as well.

Build this reflex: hosts + 2.

Choosing a prefix out of habit

Many people pick /24, /26, or /27 because it “looks right” without doing the calculation. In an exam, you are usually expected to choose the smallest prefix that satisfies the requirement.

Confusing hosts with subnets

“I need 8 subnets” is not solved the same way as “I need 8 hosts.” They are two different calculations: borrowed bits versus host bits.

Final checklist

  • Are the requested hosts usable hosts?
  • Did I calculate hosts + 2 for network + broadcast?
  • Did I choose the smallest power of two that covers the requirement?
  • Do I know how many host bits that block needs?
  • Is prefix = 32 − host_bits?
  • Did I quickly verify it with CIDR → Hosts?
Once you get this step right, the rest of subnetting becomes much more mechanical.

Related resources

This reinforces the cluster: main guide → methods → tools.

Practice

Verify a prefix and host count in 10 seconds
Use CIDR → Hosts as a checker while you practice by hand.