When you order a block of IPv4 addresses, the number of addresses in the block is not always the number you can assign to servers, virtual machines, firewalls, or other devices.
In a traditional routed IPv4 subnet, three addresses are normally unavailable to the customer:
- Network address – Identifies the subnet itself.
- Gateway address – Used by the router that connects the subnet to the network.
- Broadcast address – Used to send traffic to every device on the subnet.
That means the usual calculation is:
Customer-usable IPs = Total IPs − Network − Gateway − Broadcast
Or more simply:
Customer-usable IPs = Total IPs − 3
IPv4 Subnet Size and Usable Address Chart
| CIDR | Subnet Mask | Total IPs | Network | Gateway | Broadcast | Customer-Usable IPs |
|---|---|---|---|---|---|---|
| /24 | 255.255.255.0 | 256 | 1 | 1 | 1 | 253 |
| /25 | 255.255.255.128 | 128 | 1 | 1 | 1 | 125 |
| /26 | 255.255.255.192 | 64 | 1 | 1 | 1 | 61 |
| /27 | 255.255.255.224 | 32 | 1 | 1 | 1 | 29 |
| /28 | 255.255.255.240 | 16 | 1 | 1 | 1 | 13 |
| /29 | 255.255.255.248 | 8 | 1 | 1 | 1 | 5 |
| /30 | 255.255.255.252 | 4 | 1 | 1 | 1 | 1 |
| /31 | 255.255.255.254 | 2 | Special use | Special use | None | 2 endpoints |
Easy Reference
- A /24 contains 256 total IPs and normally provides 253 customer-usable IPs.
- A /25 contains 128 total IPs and normally provides 125 customer-usable IPs.
- A /26 contains 64 total IPs and normally provides 61 customer-usable IPs.
- A /27 contains 32 total IPs and normally provides 29 customer-usable IPs.
- A /28 contains 16 total IPs and normally provides 13 customer-usable IPs.
- A /29 contains 8 total IPs and normally provides 5 customer-usable IPs.
- A /30 contains 4 total IPs and normally provides 1 customer-usable IP when a separate gateway is required.
- A /31 contains 2 IPs but works differently from a normal customer subnet.
Example: How a /29 Is Used
Suppose you receive this subnet:
192.0.2.0/29
The block contains eight addresses:
| IP Address | Purpose |
|---|---|
| 192.0.2.0 | Network address |
| 192.0.2.1 | Gateway |
| 192.0.2.2 | Customer-usable |
| 192.0.2.3 | Customer-usable |
| 192.0.2.4 | Customer-usable |
| 192.0.2.5 | Customer-usable |
| 192.0.2.6 | Customer-usable |
| 192.0.2.7 | Broadcast address |
Although the /29 contains eight total IP addresses, only five can be assigned to the customer’s servers or devices.
Example: How a /27 Is Used
Suppose you receive:
192.0.2.0/27
- 192.0.2.0 – Network address
- 192.0.2.1 – Gateway
- 192.0.2.2 through 192.0.2.30 – 29 customer-usable addresses
- 192.0.2.31 – Broadcast address
Therefore, a /27 provides 29 customer-usable IP addresses when the gateway is located inside the subnet.
Why Do Some Charts Show a Different Number?
Many subnet calculators show the number of traditional host addresses rather than the number available to a hosting customer.
For example, a /29 is often described as having 8 total addresses and 6 host addresses. That calculation removes only the network and broadcast addresses:
8 − 2 = 6
However, when one of those six host addresses must be assigned to the gateway, only five remain available to the customer:
8 − 2 − 1 gateway = 5
This is why a hosting provider may describe a /29 as providing five usable IP addresses, even though a subnet calculator says it has six usable host addresses.
The Special Case: /31 Networks
A /31 contains only two addresses. It does not operate like a normal server or customer subnet.
RFC 3021 allows both addresses in a /31 to be used as host addresses on a point-to-point connection. Because the link has only two endpoints, it does not need separate network and broadcast addresses.
- 192.0.2.0 – First endpoint
- 192.0.2.1 – Second endpoint
A /31 is normally used for router-to-router links, switches, firewalls, tunnels, and other point-to-point connections. It is generally not used as a conventional subnet for multiple servers or virtual machines.
Important Network Configuration Note
These numbers assume a traditional configuration where the network address, gateway address, and broadcast address all come from the assigned subnet.
Some providers use routed subnets, point-to-point configurations, virtual gateways, or gateways located outside the assigned block. In those configurations, the customer may be able to use more addresses.
Always check the network information supplied with the service before configuring your servers.
Final IPv4 Address Comparison
| Subnet | Total Addresses | Traditional Host Addresses | Customer-Usable After Gateway |
|---|---|---|---|
| /24 | 256 | 254 | 253 |
| /25 | 128 | 126 | 125 |
| /26 | 64 | 62 | 61 |
| /27 | 32 | 30 | 29 |
| /28 | 16 | 14 | 13 |
| /29 | 8 | 6 | 5 |
| /30 | 4 | 2 | 1 |
| /31 | 2 | Special point-to-point use | 2 endpoints |
The most important distinction is between total IP addresses, host addresses, and addresses the customer can actually assign. When the network, gateway, and broadcast addresses are all reserved from the block, subtract three from the subnet’s total address count.
For additional technical reference, see RFC 1878 and RFC 3021.