Skip to content

Free tools /

Subnet size calculator by number of hosts

Enter how many devices need an address and get the smallest IPv4 subnet that fits them. Every ordinary subnet reserves two addresses, one for the network and one for broadcast, so the subnet is always a little larger than the number you type.

You need /25

Prefix
/25
Subnet mask
255.255.255.128
Total addresses
128
Usable hosts
126
Spare addresses for growth
26

Subnet sizes at a glance

Usable hosts for each prefix length, with the one you need highlighted
PrefixSubnet maskUsable hosts
/8255.0.0.016,777,214
/16255.255.0.065,534
/17255.255.128.032,766
/18255.255.192.016,382
/19255.255.224.08,190
/20255.255.240.04,094
/21255.255.248.02,046
/22255.255.252.01,022
/23255.255.254.0510
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522

Questions

Why is the subnet bigger than the number of hosts?

In an ordinary subnet the first address names the network and the last one is the broadcast address, so neither can be given to a device. A /24 holds 256 addresses but only 254 devices.

What if I only need two addresses?

The classic answer is a /30, which has 4 addresses and 2 usable hosts. For a direct link between two routers, RFC 3021 also allows a /31 with both addresses usable. This calculator gives the classic answer.

How much room should I leave to grow?

A common rule is to size for twice what you have today, then round up to the next subnet size. Moving devices to a bigger subnet later means renumbering, which is more work than a few spare addresses.