How subnetting works
The prefix length says how many leading bits are the network part. The rest identify hosts.
Usable hosts = 2(32 − prefix) − 2
The first address is the network address and the last is the broadcast address, so neither can be given to a device. The exceptions are /31 (two-address point-to-point links, RFC 3021) and /32 (a single host).
Example
192.168.1.10/24 has mask 255.255.255.0. Network: 192.168.1.0, broadcast: 192.168.1.255, usable hosts 192.168.1.1–192.168.1.254 (254 hosts).
CIDR cheat sheet
| Prefix | Subnet mask | Usable hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /20 | 255.255.240.0 | 4,094 |
| /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 |
Tips
- Private ranges: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
- Each step down in prefix doubles the addresses.
- Converting values by hand? The data size converter helps with bits and bytes.
Frequently asked questions
How many hosts are in a /24?
254 usable hosts (256 addresses minus the network and broadcast addresses).
What is a wildcard mask?
The inverse of the subnet mask, used in router access lists. For 255.255.255.0 it is 0.0.0.255.
Does this support IPv6?
Not yet; it works with IPv4 addresses only.
Written and checked by Vijay. Last updated .