Quick converter
Pick a prefix or type a host count. The rest of the page is the full reference.
Full subnet mask table
Every IPv4 prefix length from /0 to /32. Usable hosts subtract the network and broadcast addresses, except /31, which RFC 3021 lets you use whole on point-to-point links, and /32, which is a single host. Select a prefix to open it in the calculator.
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts | Per /24 |
|---|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 | 16,777,216 × /24 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 | 8,388,608 × /24 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 | 4,194,304 × /24 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 | 2,097,152 × /24 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 | 1,048,576 × /24 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 | 524,288 × /24 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 | 262,144 × /24 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 | 131,072 × /24 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 | 65,536 × /24 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 | 32,768 × /24 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 | 16,384 × /24 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 | 8,192 × /24 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 | 4,096 × /24 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 | 2,048 × /24 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 | 1,024 × /24 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 | 512 × /24 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 | 256 × /24 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 | 128 × /24 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 | 64 × /24 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 | 32 × /24 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 | 16 × /24 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 | 8 × /24 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 | 4 × /24 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 | 2 × /24 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 | 1 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 | 2 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 | 4 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 | 8 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 | 16 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 | 32 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 | 64 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 | 128 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 | 256 |
Last-octet masks and block sizes
Most exam questions and most office networks live in the last octet. These eight values are worth memorising. The block size is 256 minus the mask value, and subnets always start on a multiple of it.
| Prefix | Mask | Last octet | Block size | Binary of last octet | Networks start at |
|---|---|---|---|---|---|
| /25 | 255.255.255.128 | 128 | 128 | 10000000 | 0, 128… |
| /26 | 255.255.255.192 | 192 | 64 | 11000000 | 0, 64, 128, 192… |
| /27 | 255.255.255.224 | 224 | 32 | 11100000 | 0, 32, 64, 96… |
| /28 | 255.255.255.240 | 240 | 16 | 11110000 | 0, 16, 32, 48… |
| /29 | 255.255.255.248 | 248 | 8 | 11111000 | 0, 8, 16, 24… |
| /30 | 255.255.255.252 | 252 | 4 | 11111100 | 0, 4, 8, 12… |
| /31 | 255.255.255.254 | 254 | 2 | 11111110 | 0, 2, 4, 6… |
| /32 | 255.255.255.255 | 255 | 1 | 11111111 | every address |
The same pattern repeats one octet to the left. A /20 has 240 in the third octet, so its block size there is 16: networks begin at 10.0.0.0, 10.0.16.0, 10.0.32.0 and so on.
Powers of two
Host counts are always a power of two, minus two. Knowing the powers up to 216 lets you size any subnet in your head.
| Host bits | Addresses | Usable | Prefix |
|---|---|---|---|
| 1 | 2 | 2 (RFC 3021) | /31 |
| 2 | 4 | 2 | /30 |
| 3 | 8 | 6 | /29 |
| 4 | 16 | 14 | /28 |
| 5 | 32 | 30 | /27 |
| 6 | 64 | 62 | /26 |
| 7 | 128 | 126 | /25 |
| 8 | 256 | 254 | /24 |
| 9 | 512 | 510 | /23 |
| 10 | 1,024 | 1,022 | /22 |
| 11 | 2,048 | 2,046 | /21 |
| 12 | 4,096 | 4,094 | /20 |
| 13 | 8,192 | 8,190 | /19 |
| 14 | 16,384 | 16,382 | /18 |
| 15 | 32,768 | 32,766 | /17 |
| 16 | 65,536 | 65,534 | /16 |
Classful defaults
Classes were retired by CIDR in 1993 (RFC 1519), but exams and older documentation still refer to them. The class is decided by the first octet only.
| Class | First octet | Default mask | Use |
|---|---|---|---|
| A | 1 to 126 | 255.0.0.0 (/8) | Unicast (127 is loopback) |
| B | 128 to 191 | 255.255.0.0 (/16) | Unicast |
| C | 192 to 223 | 255.255.255.0 (/24) | Unicast |
| D | 224 to 239 | None | Multicast |
| E | 240 to 255 | None | Reserved |
Private and special ranges
These ranges are not routed on the public internet. Use them inside networks and behind NAT. The full story is in our guide to private IP ranges.
| Range | Purpose | Defined in |
|---|---|---|
| 10.0.0.0/8 | Private | RFC 1918 |
| 172.16.0.0/12 | Private | RFC 1918 |
| 192.168.0.0/16 | Private | RFC 1918 |
| 100.64.0.0/10 | Carrier-grade NAT | RFC 6598 |
| 127.0.0.0/8 | Loopback | RFC 1122 |
| 169.254.0.0/16 | Link-local | RFC 3927 |
| 192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24 | Documentation | RFC 5737 |