Skip to content
ENExplore Calculators

Usable Hosts In A Subnet Calculator

Work out usable hosts in a subnet instantly with clear inputs, formula shown and shareable results.

About Usable Hosts In A Subnet Calculator

A subnet reserves the all-zeros host pattern for the network address and the all-ones pattern for the broadcast address, so an IPv4 subnet with h host bits offers 2^h - 2 addresses you can assign to interfaces. Two exceptions matter in practice: an RFC 3021 /31 on a routed point-to-point link uses both addresses, and a /32 is a single host route with no broadcast at all.

Formula

Usable hosts

host bits h = 32 - prefix; usable = 2^h - reserved

h
Number of host bits
reserved
2 for a normal subnet, 0 for a /31, 1 for a /32

Worked example

With the default values below, Usable Hosts In A Subnet Calculator returns Usable hosts of 254. Change any input above and every figure here is recalculated in your browser.

Inputs used

Prefix length (/n)accepts 1–32 bits
24 bits
Address reservationone of Standard subnet (network + broadcast reserved), RFC 3021 point-to-point /31, Loopback /32 host route
Standard subnet (network + broadcast reserved)

Results

Usable hosts
254
Total addresses in block
256
Host bits
8 bits
Subnet mask
255.255.255.0

Step by step

  1. 1Values used
  2. 2Usable hosts
  3. 3Usable hosts= 254
  4. 4Total addresses in block= 256
  5. 5Host bits= 8 bits
  6. 6Subnet mask= 255.255.255.0

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why subtract two addresses?

The lowest address in the block identifies the network itself and the highest is the all-hosts broadcast, so neither can be configured on an interface in a normal subnet.

Does a /31 really give two usable hosts?

Yes. RFC 3021 allows both addresses of a /31 to be used on a routed point-to-point link because there is no need for a subnet broadcast when there are only two interfaces.

Usable Hosts In A Subnet Calculator – Calculate Usable hosts