How do you calculate a subnet?
Subnet mask = prefix ones followed by zeros (24 → 255.255.255.0) Network address = IP AND mask Broadcast address = network OR (NOT mask) Total addresses = 2^(32 − prefix); usable hosts = total − 2Example: 192.168.1.10/24. The mask is 255.255.255.0, so the network is 192.168.1.0 and the broadcast is 192.168.1.255. There are 256 addresses and 254 usable hosts (192.168.1.1 to 192.168.1.254).
Another: 10.0.5.77/20. The mask is 255.255.240.0, the network is 10.0.0.0, the broadcast 10.0.15.255 and there are 4,094 usable hosts.
Common prefix lengths
| Prefix | Mask | Addresses | Usable hosts |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,216 | 16,777,214 |
| /16 | 255.255.0.0 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 4,096 | 4,094 |
| /22 | 255.255.252.0 | 1,024 | 1,022 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
Private addresses and special cases
Three ranges are reserved for private networks and are not routed on the internet: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. A /31 is used for point-to-point links (2 addresses, no broadcast) and a /32 identifies a single host. Splitting a network into smaller subnets means increasing the prefix: a /24 splits into two /25 networks, four /26 networks and so on. Use the tool to check your plan, and see the guide to subnetting. Results are IPv4 only.
Tips for planning a network
Plan the number of hosts you need now and in the next few years, and leave room to grow. Keep a record of every subnet you assign so that ranges never overlap, and keep the first or last usable address for the gateway by habit. Use private ranges inside your network, and separate guest devices from important systems by giving them their own subnet.
Complete guide to the IP Subnet Calculator
How to use the IP Subnet Calculator, step by step
- Enter the IPv4 address.
- Choose the prefix length.
- Read the network, mask and host range.
- Check the host count against your needs.
Common mistakes to avoid
- Using the network or broadcast address for a device.
- Mixing up the subnet and wildcard masks.
- Forgetting that /31 and /32 are special.
Key terms explained
- CIDR
- Address plus prefix length, like /24.
- Subnet mask
- Shows which bits are the network.
- Broadcast address
- The last address of a subnet.
- Wildcard mask
- The inverse of the subnet mask.
Want the full walkthrough? Read our guide: How Subnetting Works (CIDR, Masks and Host Counts).
Frequently asked questions
How many hosts are in a /24?
254 usable hosts (256 addresses minus the network and broadcast addresses).
What is CIDR?
Classless Inter-Domain Routing, a way to write a network as an address and a prefix length, such as 192.168.1.0/24.
What is a wildcard mask?
The inverse of the subnet mask, used in some router access lists. For /24 it is 0.0.0.255.
What is the subnet mask for /26?
The mask for /26 is 255.255.255.192. That gives 64 addresses in total and 62 usable host addresses.
What are private IP ranges?
The three private IPv4 ranges are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are not routed on the public internet.