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
| Prefix | Subnet mask | Usable hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /17 | 255.255.128.0 | 32,766 |
| /18 | 255.255.192.0 | 16,382 |
| /19 | 255.255.224.0 | 8,190 |
| /20 | 255.255.240.0 | 4,094 |
| /21 | 255.255.248.0 | 2,046 |
| /22 | 255.255.252.0 | 1,022 |
| /23 | 255.255.254.0 | 510 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /29 | 255.255.255.248 | 6 |
| /30 | 255.255.255.252 | 2 |
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.