Subnet Mask Cheat Sheet: CIDR Chart /0 to /32
A subnet mask tells a device which bits of an IPv4 address identify the network. In CIDR notation the number after the slash counts those network bits, so /24 means 255.255.255.0: 256 addresses, 254 of them usable by hosts. The chart below lists every prefix from /32 down to /0 with its dotted mask, wildcard mask and host count.
1. CIDR to Subnet Mask Chart
| CIDR | Subnet mask | Wildcard mask | Addresses | Usable hosts |
|---|---|---|---|---|
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (single host) |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (point-to-point links) |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
Usable hosts are the addresses minus the network and broadcast addresses. Two prefixes are exceptions: a /31 gives both addresses to the two ends of a point-to-point link (RFC 3021), and a /32 identifies one host, as in a loopback or host route.
2. Core Formulas
- Host bits = 32 minus the prefix length.
- Addresses per subnet = 2 to the power of the host bits.
- Usable hosts = addresses minus 2 (except /31 and /32).
- Subnets created = 2 to the power of the bits you borrow from the parent network.
- Block size = 256 minus the mask value in the interesting octet.
- Wildcard mask = 255 minus each octet of the subnet mask.
3. Fast Method (do this in your head)
Given an IP address and a mask:
- Find the interesting octet, the rightmost mask octet that is not 0 or 255 (for /27 it is the fourth octet, 224).
- Block size = 256 minus that value. For /27, 256 minus 224 = 32.
- Subnet boundaries are multiples of the block size in that octet: 0, 32, 64, 96, 128, 160, 192, 224.
- The host's subnet is the largest boundary that is not above the host's value in that octet.
- Network address = that boundary. Broadcast = the next boundary minus 1.
- Usable range = network plus 1 up to broadcast minus 1.
4. Worked Examples
Example A: 172.16.45.50/26
- Mask 255.255.255.192, so the block size is 256 minus 192 = 64.
- Boundaries: 0, 64, 128, 192. The value 50 falls in the 0 subnet.
- Network 172.16.45.0, broadcast 172.16.45.63, hosts .1 to .62.
Example B: 10.1.20.130/27
- Mask 255.255.255.224, block size 32.
- Boundaries: 0, 32, 64, 96, 128, 160, 192, 224. The value 130 falls in the 128 subnet.
- Network 10.1.20.128, broadcast 10.1.20.159, hosts .129 to .158.
Example C: 192.168.5.200/29
- Mask 255.255.255.248, block size 8.
- 200 sits exactly on a boundary, so it is the network address of 192.168.5.200/29.
- Broadcast 192.168.5.207, hosts .201 to .206.
Example D: a /30 point-to-point link, 10.10.10.0/30
- Block size 4, so the subnets are .0, .4, .8, .12 and so on.
- For the .0 subnet: network .0, broadcast .3, usable hosts .1 and .2.
Example E: splitting 192.168.1.0/24 into two /25s
- Block size 128.
- 192.168.1.0/25: hosts .1 to .126, broadcast .127.
- 192.168.1.128/25: hosts .129 to .254, broadcast .255.
5. VLSM Design (largest subnet first)
A 200-host LAN, a 60-host LAN, a 28-host LAN and a 2-host WAN link will not fit in one /24, because the 200-host LAN alone needs a /24. Start from 10.0.0.0/23 (510 usable addresses) and allocate the largest block first:
| Subnet | Prefix | Network | Broadcast | Usable hosts |
|---|---|---|---|---|
| 200-host LAN | /24 | 10.0.0.0 | 10.0.0.255 | .1 to .254 |
| 60-host LAN | /26 | 10.0.1.0 | 10.0.1.63 | .1 to .62 |
| 28-host LAN | /27 | 10.0.1.64 | 10.0.1.95 | .65 to .94 |
| 2-host WAN | /30 | 10.0.1.96 | 10.0.1.99 | .97 and .98 |
Rule of thumb: sort the networks by size, biggest first, then walk through the address space so every block starts on its own boundary.
6. Wildcard Masks (for ACLs and OSPF)
A wildcard mask is the inverse of the subnet mask. For /27 (mask 255.255.255.224) the wildcard is 0.0.0.31. Cisco ACLs and OSPF network statements use it:
access-list 10 permit 192.168.5.32 0.0.0.31 matches 192.168.5.32 to 192.168.5.63.
7. Reserved IPv4 Ranges
| Block | Range | Use |
|---|---|---|
| 10.0.0.0/8 | 10.0.0.0 to 10.255.255.255 | Private (RFC 1918), large networks |
| 172.16.0.0/12 | 172.16.0.0 to 172.31.255.255 | Private (RFC 1918) |
| 192.168.0.0/16 | 192.168.0.0 to 192.168.255.255 | Private (RFC 1918), home and small office |
| 169.254.0.0/16 | 169.254.0.0 to 169.254.255.255 | Link-local (APIPA) when DHCP fails |
| 127.0.0.0/8 | 127.0.0.0 to 127.255.255.255 | Loopback |
8. Common Mistakes to Avoid
- Confusing the block size with the number of usable hosts: the block includes the network and broadcast addresses.
- Treating a /31 as unusable: under RFC 3021 both addresses work on a point-to-point link.
- Putting a subnet mask where an ACL expects a wildcard mask. They are inverses.
- Counting the broadcast address as a usable host.
Written by CISNET instructors. Print this page (Cmd or Ctrl + P, then Save as PDF) for an offline copy. Work any address with the subnet calculator and build speed with subnetting practice.
Frequently Asked Questions
What is the subnet mask for /24?
255.255.255.0. A /24 has 24 network bits and 8 host bits, so it holds 256 addresses. Removing the network and broadcast addresses leaves 254 usable host addresses, which is why /24 is the usual size for an office LAN.
How do you calculate the number of hosts in a subnet?
Raise 2 to the number of host bits and subtract 2. Host bits are 32 minus the prefix, so a /27 has 5 host bits: 2 to the 5th is 32 addresses and 30 usable hosts. A /31 is the exception, giving 2 usable addresses on point-to-point links under RFC 3021.
What is a wildcard mask?
A wildcard mask is the inverse of a subnet mask, used in Cisco ACLs and OSPF network statements. Subtract each octet of the subnet mask from 255: the /27 mask 255.255.255.224 becomes the wildcard 0.0.0.31, which matches a block of 32 addresses.
What does CIDR notation mean?
CIDR (Classless Inter-Domain Routing) notation writes the mask as a slash and the number of network bits, so 192.168.1.0/24 means the first 24 bits are the network. It replaced the fixed Class A, B and C masks and is defined in RFC 4632.
Use Cmd/Ctrl + P → Save as PDF for an offline copy.