IP Subnet Calculator
Enter an IP address and a CIDR prefix to get the network address, broadcast address, subnet mask and the range of usable host addresses.
Formula
Addresses in a subnet = 2^(32 − prefix) · Usable hosts = that − 2
- The two reserved are the network address and the broadcast address
- A /31 point-to-point link is the exception to the minus two
A /26 holds 2⁶ = 64 addresses, of which 62 are usable
What the CIDR Number Means
The number after the slash is how many bits are fixed as the network portion. The rest identify hosts.
Total addresses = 2(32 − prefix), of which two are unusable: the network address itself and the broadcast address.
- /24: 256 addresses, 254 usable
- /26: 64 addresses, 62 usable
- /30: 4 addresses, 2 usable — the classic point-to-point link
Reading a Subnet Mask
A mask is the same information in dotted-decimal form. A /24 is 255.255.255.0: three octets of ones followed by eight zeros.
Because prefixes are binary, subnet sizes only ever double. There is no way to make a subnet holding exactly 100 hosts — you take a /25 with 126 usable addresses and accept the spare.
Private Ranges and Common Mistakes
Three ranges are reserved for private use: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Home routers almost always use the last.
The most common planning error is forgetting the two reserved addresses and sizing a subnet exactly to the host count. The second is overlapping ranges, which is why two networks both using 192.168.1.0/24 cannot be joined by a VPN without renumbering one of them.
Quick Reference
| Prefix | Subnet mask | Addresses | Usable hosts |
|---|---|---|---|
| /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 |
| /30 | 255.255.255.252 | 4 | 2 |
Frequently Asked Questions
- How many usable hosts are in a /24?
- 254. A /24 has 256 addresses, but the network and broadcast addresses cannot be assigned to devices.
- What does the /24 actually mean?
- That the first 24 bits are the network portion, leaving 8 bits for hosts. It is equivalent to the mask 255.255.255.0.
- Why can I not create a subnet for exactly 100 hosts?
- Subnets are sized in powers of two. The smallest that fits 100 devices is a /25 with 126 usable addresses.
- Which IP ranges are private?
- 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. They are not routable on the public internet and are reused on every private network.