No ads, no sign-upChecked 2026-08-25

Subnet Hosts Calculator

Result

254hosts

Result: 254 hosts
How the result moves

Host bits are 32 minus the prefix, and two addresses are always reserved — the network address and the broadcast address. So a /24 has 2⁸ − 2 = 254 usable hosts, and a /16 has 65,534. A /31 and a /32 have no usable host range at all.

Worked examples

How it's calculated

usable hosts = 2^(32 − prefix) − 2

  1. StepEnter the number after the slash, for example 24.
  2. StepHost bits are 32 minus that prefix.
  3. StepTwo to the host bits gives every address in the subnet.
  4. ResultSubtract the network and the broadcast address.

What this number means

An IPv4 address is 32 bits long, and the prefix written after the slash says how many of those bits name the network. Everything left over numbers the individual machines inside it, so the prefix alone fixes how large a subnet is: the host bits are 32 minus the prefix, and two raised to that count is every address the block contains. Two of those bit patterns are spoken for by convention rather than by arithmetic — all host bits zero identifies the subnet itself, all host bits one is the broadcast — and that is where the subtraction of two comes from. The default setting runs through in one line: a /24 leaves 8 host bits, so 2⁸ = 256 addresses and 256 − 2 = 254 usable ones. Because the prefix moves the exponent, the count changes by doubling rather than by steps: a /25 holds 126, a /16 holds 65,534 and a /0 holds 4,294,967,294. What the result does not give you is a range. It counts addresses without saying where the block starts, which two of them are the reserved pair, or how a larger allocation should be carved up. And the minus two is a rule about ordinary subnets rather than about the arithmetic, which is why the two smallest blocks fall outside it and are clamped to zero.

Two addresses are never handed to a device

The first address in an ordinary subnet names the network itself, and the last one is the broadcast address that reaches every host at once. Neither can be assigned, which is where the minus two in 2^n − 2 comes from.

/31 and /32 are the exceptions

The plain formula would give 0 for a /31 and −1 for a /32, so the result is clamped to 0. A /31 uses both of its addresses for a point-to-point link under RFC 3021, and a /32 is a single-address host route.

One bit less in the prefix roughly doubles the hosts

A /25 holds 126 usable hosts, a /24 holds 254 and a /16 holds 65,534. Each bit taken from the prefix is a bit added to the host part.

Commonly misread

A /24 has 256 usable hosts.

It has 256 addresses but only 254 usable ones, because the network and broadcast address are reserved.

A bigger prefix number means a bigger subnet.

The prefix counts the leading bits that identify the network, so a larger prefix leaves fewer host bits. A /25 is half the size of a /24.

A /30 is useless because it only has 4 addresses.

Two of those four are usable, which is exactly what a point-to-point link between two routers needs.

Reference table

PrefixWhat it usually isUsable hosts
0the whole IPv4 space4294967294
8a former class A block16777214
16a former class B block65534
24a typical office or home LAN254
25half a LAN126
30a point-to-point link2
31point-to-point under RFC 30210
32a single host route0

Questions

How do I calculate the usable hosts in a subnet?

Raise two to the number of host bits and subtract two: 2^(32 − prefix) − 2. The host bits are 32 minus the CIDR prefix length, and the minus two removes the network and broadcast addresses. A /24 therefore holds 254 usable hosts.

Why subtract 2 from the total number of addresses?

Two addresses in every ordinary subnet are reserved: the network address, the first one, which names the subnet itself, and the broadcast address, the last one, which reaches all hosts at once. Neither can be given to a device, so a /24 with 256 addresses has only 254 usable ones.

How many usable hosts are in a /24?

254. A /24 has 8 host bits, so 2⁸ = 256 addresses, minus the network and broadcast address. A /16 holds 65,534, a /25 holds 126 and a /30 holds just 2 — each smaller prefix roughly doubles the count.

What about /31 and /32 subnets?

They are special cases. A /31 has two addresses and, under RFC 3021, uses both for a point-to-point link with nothing reserved, while a /32 is a single-address host route. The classic formula would give 0 and −1 there, so the result is clamped to 0.

What does the CIDR prefix length mean?

It is the /n written after an IP address, as in 192.168.1.0/24, and it counts the leading bits that identify the network. The remaining 32 − n bits number the individual hosts. A larger prefix means fewer host bits and fewer usable addresses.

Sources and last check

  1. datatracker.ietf.org

Information, not professional advice.