Telecom & Networking
Intermediate

Usable Subnet Hosts

Number of usable IPv4 addresses in a subnet with an n-bit prefix.

Formula

H=2(32−n)−2H = 2^{(32-n)} - 2

Live Calculator

Members

Variables

HUsable hosts
nPrefix length (bits)

Example

/24 network: H = 2⁸ - 2 = 254

How it works

An IPv4 address has 32 bits, so if a subnet uses an n-bit prefix, the remaining 32 - n bits are available for host addresses. That means the subnet contains 2^(32 - n) total address combinations, but two of them cannot be assigned to devices: the all-zeros address identifies the subnet itself, and the all-ones address is the broadcast address. Subtracting those two leaves the number of usable host addresses.

When to use it

Use this when planning or checking IPv4 subnet sizes, such as deciding how many devices fit in a network segment. It is also useful in exams, network design, and troubleshooting address allocation.

Worked example, step by step

/27 subnet H = 2^(32 - 27) - 2 H = 2^5 - 2 H = 32 - 2 H = 30 usable hosts

Common mistakes to avoid

  • Forgetting to subtract 2 for the network and broadcast addresses
  • Using the wrong prefix length, especially confusing /24 with /32
  • Applying this formula to IPv6, where the addressing rules are different

Did You Know?

Two addresses are always reserved: one for the network itself and one for broadcast.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026