
Netmask Cheat Sheet: CIDR, Subnet Masks, and Wildcard Masks
A netmask is a 32-bit number that splits an IP address into a network part and a host part. It tells a device which portion of an address identifies the network and which portion identifies a single host on that network. This netmask cheat sheet gives you the full CIDR table from /0 to /32, with subnet masks, wildcard masks, total addresses, and usable hosts, plus worked examples, private address ranges, and the mistakes that cause most subnetting errors. Bookmark it, and you will rarely need a subnet calculator again.
What Is a Netmask?
A netmask, or subnet mask, is written in dotted decimal form, such as 255.255.255.0, or in CIDR notation, such as /24. Both forms describe the same thing: how many bits of the IP address belong to the network. In 255.255.255.0, the first three octets are all 255, which in binary is 24 ones followed by 8 zeros. That means the first 24 bits are the network, and the last 8 bits are the host.
When a device wants to send a packet, it applies the netmask to the destination IP address with a bitwise AND operation. The result is the network address. If that network address matches the device’s own network, the destination is local, and the device uses its ARP table to find the destination’s MAC address. If it does not match, the destination is remote, and the device sends the packet to its default gateway. That one decision, local or remote, is the job of the netmask.
Dotted Decimal vs. CIDR Notation
Older documentation uses dotted decimal masks, such as 255.255.255.192. Modern documentation uses CIDR notation, such as /26, which simply counts the number of network bits. A /26 mask has 26 ones, so it is 255.255.255.192, with 6 host bits left. The table below lists both forms side by side, so you can convert in either direction at a glance.
CIDR notation is shorter, easier to compare, and the standard in cloud, firewall, and routing configuration. If you see 10.0.0.0/8, 172.16.0.0/12, or 192.168.1.0/24, you are looking at a network address and its netmask in CIDR form.
Private IP Address Ranges
Before you use the table, remember the three private ranges defined in RFC 1918. These addresses are not routed on the public internet, so they are used inside homes and organizations.
| Range | CIDR | Addresses | Typical Use |
|---|---|---|---|
| 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | 16,777,216 | Large enterprise networks |
| 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | 1,048,576 | Medium networks, cloud VPCs |
| 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | 65,536 | Home and small office networks |
There is also the link-local range 169.254.0.0/16, used by APIPA when a device cannot reach a DHCP server, and the loopback range 127.0.0.0/8, used for traffic to the device itself.
What Is a Wildcard Mask?
A wildcard mask is the inverse of a subnet mask. It is used mainly in Cisco access control lists and OSPF network statements. To get a wildcard mask, subtract each octet of the subnet mask from 255. For a /24 mask, 255.255.255.0 becomes a wildcard of 0.0.0.255. For a /26 mask, 255.255.255.192 becomes 0.0.0.63. A 0 in a wildcard mask means the bit must match exactly, and a 1 means the bit is ignored. Do not confuse a wildcard mask with a subnet mask: they are opposites, and using one where the other is expected is a common cause of firewall rules that allow or block the wrong traffic.
Netmask Cheat Sheet: Full CIDR Table /0 to /32
Use this table to look up any prefix. Total addresses are 2 to the power of the number of host bits. Usable hosts are total addresses minus 2, for the network and broadcast addresses, except for /31 and /32, which are special cases explained below the table.
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts |
|---|---|---|---|---|
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts |
|---|---|---|---|---|
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2* |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
* A /31 network has two addresses and no separate network or broadcast address. Under RFC 3021, both addresses can be used for a point-to-point link between two routers. A /32 is a single host address, used for loopbacks and host routes. Every other prefix loses two addresses to the network and broadcast addresses.
Common Subnets at a Glance
Most day-to-day work uses only a handful of prefixes. A /24 is a standard small network with 254 usable hosts. A /25 splits a /24 in half, with 126 hosts each. A /26 gives 62 hosts, a /27 gives 30, a /28 gives 14, a /29 gives 6, and a /30 gives 2, which is the classic choice for a link between two routers. A /23 gives 510 hosts, a /22 gives 1,022, a /21 gives 2,046, a /20 gives 4,094, and a /16 gives 65,534. If you remember that each step down in CIDR doubles the number of addresses, you can estimate any prefix without the table.
Worked Examples
Example 1: 192.168.1.0/24
The mask is 255.255.255.0. The network address is 192.168.1.0, the broadcast address is 192.168.1.255, and usable hosts run from 192.168.1.1 to 192.168.1.254, for a total of 254 hosts. This is the default subnet for most home routers.
Example 2: 10.1.4.0/26
The mask is 255.255.255.192, with 64 total addresses. The network address is 10.1.4.0, the broadcast address is 10.1.4.63, and usable hosts run from 10.1.4.1 to 10.1.4.62. The next /26 subnet starts at 10.1.4.64.
Example 3: Splitting a /24 into Four /26 Subnets
Start with 192.168.10.0/24. Borrowing two host bits gives four /26 subnets, each with 62 usable hosts: 192.168.10.0/26 (hosts .1 to .62, broadcast .63), 192.168.10.64/26 (hosts .65 to .126, broadcast .127), 192.168.10.128/26 (hosts .129 to .190, broadcast .191), and 192.168.10.192/26 (hosts .193 to .254, broadcast .255). This is the basis of VLSM, variable length subnet masking, where different subnets in the same network can have different sizes.
Example 4: How Many Hosts Do I Need?
If you need 50 usable hosts, a /26, with 62 usable hosts, is the smallest prefix that fits, with room to grow. A /27, with 30 usable hosts, is too small. If you need 500 hosts, a /23, with 510 usable hosts, is the smallest fit. Always leave room for growth, and remember to count the gateway, printers, and other infrastructure devices, not just user computers.
How to Calculate a Netmask Without a Calculator
Start with the number of hosts you need, add 2 for the network and broadcast addresses, and round up to the next power of 2. That gives you the total number of addresses. The number of host bits is the exponent, and the CIDR prefix is 32 minus the host bits. For example, 50 hosts plus 2 equals 52, which rounds up to 64, which is 2 to the power of 6. So you need 6 host bits, and the prefix is 32 minus 6, which is /26.
To find the subnet mask from the prefix, write out the binary: a /26 mask is 26 ones followed by 6 zeros, grouped into octets as 11111111.11111111.11111111.11000000, which is 255.255.255.192. To find the network address, apply the mask to the IP address. To find the broadcast address, set all host bits to 1. To find the first and last usable hosts, add 1 to the network address and subtract 1 from the broadcast address.
Common Mistakes to Avoid
First, forgetting the network and broadcast addresses, and counting 256 usable hosts in a /24 instead of 254. Second, using a wildcard mask where a subnet mask is expected, or the other way around. Third, choosing a subnet that is too small, and then having to renumber the network when it grows. Fourth, overlapping subnets, which happen when a larger subnet contains a smaller one that is also in use. Fifth, using a public IP range inside a private network, which can cause routing problems if that public range is ever needed. Sixth, assuming that a /31 has no usable hosts. Under RFC 3021, a /31 link between two routers can use both addresses, but not all equipment supports it, so check before you rely on it.
Netmask Security Notes
A netmask does not provide security on its own. It defines the boundary of a broadcast domain, but it does not stop an attacker who is already on the network. Use the smallest subnet that fits, segment networks with VLANs and firewalls, and use a network switch with proper access controls, so a compromised device in one subnet cannot reach sensitive systems in another. Keep a record of your subnets, and review it regularly, because undocumented subnets are a common source of both outages and security gaps.
Frequently Asked Questions
What is a netmask?
A netmask is a 32-bit number that divides an IP address into a network part and a host part. It is written as a dotted decimal mask, such as 255.255.255.0, or as a CIDR prefix, such as /24.
What is the netmask for a /24 network?
The netmask for a /24 network is 255.255.255.0. It has 256 total addresses and 254 usable hosts, from .1 to .254, with .0 as the network address and .255 as the broadcast address.
How do I find the wildcard mask?
Subtract each octet of the subnet mask from 255. For 255.255.255.192, the wildcard mask is 0.0.0.63. Wildcard masks are used in Cisco access control lists and OSPF configuration.
How many hosts are in a /26 subnet?
A /26 subnet has 64 total addresses and 62 usable hosts. The mask is 255.255.255.192, and the wildcard mask is 0.0.0.63.
What is the difference between a netmask and a subnet mask?
There is no practical difference. Netmask and subnet mask are two names for the same thing: the mask that separates the network part of an IP address from the host part.
Conclusion
A netmask is a simple idea with a big effect on how networks are designed, secured, and troubleshot. With this cheat sheet, you can look up any CIDR prefix, convert it to a subnet mask and a wildcard mask, work out how many hosts fit, and avoid the off-by-two and overlapping-subnet mistakes that cause most subnetting problems. Keep it handy the next time you plan a network, write a firewall rule, or split a subnet, and use the smallest subnet that fits, with room to grow.


