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

Subnet Hosts Calculator

Your numbers

Change any value to update the result.

Usable hosts

254hosts

Usable hosts: 254 hosts
Examples

For ordinary subnets, subtract the network and broadcast addresses: a /24 has 2⁸ − 2 = 254 usable hosts. On an RFC 3021 point-to-point link, a /31 has 2 usable endpoints; a /32 is one host address.

The numbers at a glance

CIDR prefix length (/n)Usable hosts
1665,534
1816,382
204,094
221,022
24Your value254
2662
2814
302
321

Worked examples

How it's calculated

ordinary subnet: 2^(32 − prefix) − 2; /31: 2; /32: 1

  1. StepEnter the number after the slash, for example 24.
  2. StepHost bits are 32 minus that prefix.CIDR prefix length (/n)=24
  3. StepTwo to the host bits gives every address in the subnet.
  4. ResultFor ordinary subnets, subtract network and broadcast; /31 links use both addresses and /32 host routes use one.254hosts

What this number means

An IPv4 address is 32 bits long, and the prefix says how many bits name the network. The remaining 32 minus prefix bits identify addresses in the block. In an ordinary subnet, the all-zero host pattern names the network and the all-one pattern is broadcast, so two addresses are reserved.

A /24 leaves 8 host bits: 2⁸ = 256 addresses and 254 usable hosts. A /25 has 126, a /16 has 65,534 and a /0 has 4,294,967,294. The two smallest blocks are exceptions.

RFC 3021 makes both addresses of a /31 usable endpoints on a point-to-point link. A /32 denotes one host address. The result is a count, not an address range: it does not say where the block starts or how to divide a larger allocation.

Two addresses are reserved in ordinary subnets

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 there, which is where the minus two in 2^n − 2 comes from.

/31 and /32 are the exceptions

A /31 uses both addresses as endpoints on an RFC 3021 point-to-point link, so it returns 2. A /32 is a single-address host route and returns 1. The ordinary minus-two rule does not apply to either case.

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

MisconceptionA /24 has 256 usable hosts.

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

MisconceptionA bigger prefix number means a bigger subnet.

CorrectionThe 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.

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

CorrectionTwo 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 30212
32a single host route1

Questions

How do I calculate the usable hosts in a subnet?

For ordinary subnets, raise two to the host-bit count and subtract two: 2^(32 − prefix) − 2. A /24 has 254 usable hosts. A /31 point-to-point link has 2 usable endpoints, and a /32 host route has 1 address.

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?

Under RFC 3021, a /31 uses both addresses as point-to-point endpoints, so this calculator returns 2. A /32 is a host route containing one address, so it returns 1. Neither uses the ordinary minus-two rule.

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. rfc-editor.org

Information, not professional advice.