IPv4 reference
Subnet mask cheat sheet
Every IPv4 prefix from /8 to /32 with its dotted subnet mask, wildcard mask, block size, total addresses and usable hosts. A /24 is 255.255.255.0 with 254 usable hosts; each extra bit of prefix halves the subnet.
Every prefix from /8 to /32
Usable hosts are the total minus the network and broadcast addresses. The AWS column subtracts the five addresses AWS reserves in every VPC subnet, for the sizes AWS allows.
| CIDR | Subnet mask | Wildcard | Block size | Addresses | Usable hosts | Usable in AWS |
|---|---|---|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 256 | 16,777,216 | 16,777,214 | — |
| /9 | 255.128.0.0 | 0.127.255.255 | 128 | 8,388,608 | 8,388,606 | — |
| /10 | 255.192.0.0 | 0.63.255.255 | 64 | 4,194,304 | 4,194,302 | — |
| /11 | 255.224.0.0 | 0.31.255.255 | 32 | 2,097,152 | 2,097,150 | — |
| /12 | 255.240.0.0 | 0.15.255.255 | 16 | 1,048,576 | 1,048,574 | — |
| /13 | 255.248.0.0 | 0.7.255.255 | 8 | 524,288 | 524,286 | — |
| /14 | 255.252.0.0 | 0.3.255.255 | 4 | 262,144 | 262,142 | — |
| /15 | 255.254.0.0 | 0.1.255.255 | 2 | 131,072 | 131,070 | — |
| /16 | 255.255.0.0 | 0.0.255.255 | 256 | 65,536 | 65,534 | 65,531 |
| /17 | 255.255.128.0 | 0.0.127.255 | 128 | 32,768 | 32,766 | 32,763 |
| /18 | 255.255.192.0 | 0.0.63.255 | 64 | 16,384 | 16,382 | 16,379 |
| /19 | 255.255.224.0 | 0.0.31.255 | 32 | 8,192 | 8,190 | 8,187 |
| /20 | 255.255.240.0 | 0.0.15.255 | 16 | 4,096 | 4,094 | 4,091 |
| /21 | 255.255.248.0 | 0.0.7.255 | 8 | 2,048 | 2,046 | 2,043 |
| /22 | 255.255.252.0 | 0.0.3.255 | 4 | 1,024 | 1,022 | 1,019 |
| /23 | 255.255.254.0 | 0.0.1.255 | 2 | 512 | 510 | 507 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 256 | 254 | 251 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 128 | 126 | 123 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 64 | 62 | 59 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 32 | 30 | 27 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 16 | 14 | 11 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 8 | 6 | — |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 4 | 2 | — |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | 2 | — |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | 1 | — |
Mask values and block sizes
Where a mask stops being 255, the next octet is either 0 or one of seven values. Learn the seven and the block size of any prefix follows: it is 256 minus the mask value.
| Mask octet | Binary | Prefixes | Block size |
|---|---|---|---|
| 128 | 10000000 | /9, /17, /25 | 128 |
| 192 | 11000000 | /10, /18, /26 | 64 |
| 224 | 11100000 | /11, /19, /27 | 32 |
| 240 | 11110000 | /12, /20, /28 | 16 |
| 248 | 11111000 | /13, /21, /29 | 8 |
| 252 | 11111100 | /14, /22, /30 | 4 |
| 254 | 11111110 | /15, /23, /31 | 2 |