- Home
- Tools
- Network Tools
- Subnet Calculator
- Subnet Mask Cheat Sheet
Subnet Mask Cheat Sheet
Every IPv4 prefix length from /0 to /32 with its subnet mask, wildcard mask, number of addresses and usable hosts.
| Prefix | Subnet mask | Usable hosts |
|---|---|---|
| /0 | 0.0.0.0 | 4,294,967,294 |
| Wildcard 255.255.255.255 · 4,294,967,296 addresses | ||
| /1 | 128.0.0.0 | 2,147,483,646 |
| Wildcard 127.255.255.255 · 2,147,483,648 addresses | ||
| /2 | 192.0.0.0 | 1,073,741,822 |
| Wildcard 63.255.255.255 · 1,073,741,824 addresses | ||
| /3 | 224.0.0.0 | 536,870,910 |
| Wildcard 31.255.255.255 · 536,870,912 addresses | ||
| /4 | 240.0.0.0 | 268,435,454 |
| Wildcard 15.255.255.255 · 268,435,456 addresses | ||
| /5 | 248.0.0.0 | 134,217,726 |
| Wildcard 7.255.255.255 · 134,217,728 addresses | ||
| /6 | 252.0.0.0 | 67,108,862 |
| Wildcard 3.255.255.255 · 67,108,864 addresses | ||
| /7 | 254.0.0.0 | 33,554,430 |
| Wildcard 1.255.255.255 · 33,554,432 addresses | ||
| /8 | 255.0.0.0 | 16,777,214 |
| Wildcard 0.255.255.255 · 16,777,216 addresses | ||
| /9 | 255.128.0.0 | 8,388,606 |
| Wildcard 0.127.255.255 · 8,388,608 addresses | ||
| /10 | 255.192.0.0 | 4,194,302 |
| Wildcard 0.63.255.255 · 4,194,304 addresses | ||
| /11 | 255.224.0.0 | 2,097,150 |
| Wildcard 0.31.255.255 · 2,097,152 addresses | ||
| /12 | 255.240.0.0 | 1,048,574 |
| Wildcard 0.15.255.255 · 1,048,576 addresses | ||
| /13 | 255.248.0.0 | 524,286 |
| Wildcard 0.7.255.255 · 524,288 addresses | ||
| /14 | 255.252.0.0 | 262,142 |
| Wildcard 0.3.255.255 · 262,144 addresses | ||
| /15 | 255.254.0.0 | 131,070 |
| Wildcard 0.1.255.255 · 131,072 addresses | ||
| /16 | 255.255.0.0 | 65,534 |
| Wildcard 0.0.255.255 · 65,536 addresses | ||
| /17 | 255.255.128.0 | 32,766 |
| Wildcard 0.0.127.255 · 32,768 addresses | ||
| /18 | 255.255.192.0 | 16,382 |
| Wildcard 0.0.63.255 · 16,384 addresses | ||
| /19 | 255.255.224.0 | 8,190 |
| Wildcard 0.0.31.255 · 8,192 addresses | ||
| /20 | 255.255.240.0 | 4,094 |
| Wildcard 0.0.15.255 · 4,096 addresses | ||
| /21 | 255.255.248.0 | 2,046 |
| Wildcard 0.0.7.255 · 2,048 addresses | ||
| /22 | 255.255.252.0 | 1,022 |
| Wildcard 0.0.3.255 · 1,024 addresses | ||
| /23 | 255.255.254.0 | 510 |
| Wildcard 0.0.1.255 · 512 addresses | ||
| /24 | 255.255.255.0 | 254 |
| Wildcard 0.0.0.255 · 256 addresses | ||
| /25 | 255.255.255.128 | 126 |
| Wildcard 0.0.0.127 · 128 addresses | ||
| /26 | 255.255.255.192 | 62 |
| Wildcard 0.0.0.63 · 64 addresses | ||
| /27 | 255.255.255.224 | 30 |
| Wildcard 0.0.0.31 · 32 addresses | ||
| /28 | 255.255.255.240 | 14 |
| Wildcard 0.0.0.15 · 16 addresses | ||
| /29 | 255.255.255.248 | 6 |
| Wildcard 0.0.0.7 · 8 addresses | ||
| /30 | 255.255.255.252 | 2 |
| Wildcard 0.0.0.3 · 4 addresses | ||
| /31 | 255.255.255.254 | 2 |
| Wildcard 0.0.0.1 · 2 addresses | ||
| /32 | 255.255.255.255 | 1 |
| Wildcard 0.0.0.0 · 1 address | ||
Reading the table
Each step down the table moves one bit from the host part of an address to the network part, so the number of addresses halves. Two addresses of a network cannot be given to a device, the network address and the broadcast address, which is why the last column is two lower. The bottom two rows are the exceptions: both addresses of a /31 are usable on a link between two routers, and a /32 is a single host.
The wildcard mask is the subnet mask with every bit flipped. Cisco access lists and OSPF use it.
The eight numbers a mask is made of
A mask is a run of ones followed by zeros, so besides 0 only eight values can occur in it. Which one depends on how many bits of that number belong to the network:
| Network bits in that number | Number in the mask | Networks are this far apart |
|---|---|---|
| 1 | 128 | 128 |
| 2 | 192 | 64 |
| 3 | 224 | 32 |
| 4 | 240 | 16 |
| 5 | 248 | 8 |
| 6 | 252 | 4 |
| 7 | 254 | 2 |
| 8 | 255 | 1 |
The right-hand column is the handy one. With the mask 255.255.255.224, networks are 32 addresses apart and start at .0, .32, .64 and so on. With 255.255.240.0 they are 16 apart in the third number: 10.0.0.0, 10.0.16.0, 10.0.32.0.
Without the table
Two sums replace it. The number of addresses is 2 to the power of (32 − prefix): a /27 has 2⁵ = 32. And 256 minus the one number of the mask that is neither 255 nor 0 gives the distance between networks: for 255.255.255.224 that is 256 − 224 = 32.
Going the other way, count the ones. 255 is eight of them and 224 is three, so 255.255.255.224 is 8 + 8 + 8 + 3 = /27.
For one particular address, the subnet calculator works out the network, the host range and the broadcast address, and splits a network into subnets.
A page for each prefix length
- /8 (255.0.0.0)
- /12 (255.240.0.0)
- /16 (255.255.0.0)
- /20 (255.255.240.0)
- /21 (255.255.248.0)
- /22 (255.255.252.0)
- /23 (255.255.254.0)
- /24 (255.255.255.0)
- /25 (255.255.255.128)
- /26 (255.255.255.192)
- /27 (255.255.255.224)
- /28 (255.255.255.240)
- /29 (255.255.255.248)
- /30 (255.255.255.252)
- /31 (255.255.255.254)
- /32 (255.255.255.255)