Convert any subnet mask to its wildcard mask (or vice versa) instantly. Enter either format and get the complementary mask, CIDR prefix length, and binary breakdown — all calculated locally in your browser.

A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask uses 1-bits to identify the network portion and 0-bits for the host portion, a wildcard mask flips that logic — 0-bits mean "must match" and 1-bits mean "don't care." Wildcard masks are primarily used in Cisco IOS access control lists (ACLs) and OSPF area configurations.
For example, a /24 subnet mask of 255.255.255.0 has the wildcard mask 0.0.0.255. The first three octets must match exactly, while the last octet can be anything. If you're already comfortable with subnetting and CIDR notation, wildcard masks are simply the complement.
Understanding the relationship between these two mask types is fundamental to configuring IP networking equipment. The conversion is straightforward — subtract each octet from 255:
| Subnet Mask | Wildcard Mask | CIDR | Relationship |
|---|---|---|---|
| 255.255.255.0 | 0.0.0.255 | /24 | 255 - 255 = 0, 255 - 0 = 255 |
| 255.255.0.0 | 0.0.255.255 | /16 | Network = first 2 octets, host = last 2 |
| 255.255.255.128 | 0.0.0.127 | /25 | Splits the last octet in half |
| 255.255.255.192 | 0.0.0.63 | /26 | 4 subnets of 64 addresses each |
| 255.255.255.240 | 0.0.0.15 | /28 | 16 subnets of 16 addresses each |
| 255.255.252.0 | 0.0.3.255 | /22 | Supernet spanning 4 class C blocks |
Pro Tip: The fastest way to compute a wildcard mask in your head is to subtract each octet of the subnet mask from 255. For 255.255.248.0, that's 0.0.7.255. No binary math required. If you need to verify, check the binary with our IP to Binary Converter.
The mathematical operation behind the conversion is a bitwise NOT (complement). For a 32-bit subnet mask, each bit is flipped:
Subnet Mask: 255.255.255.0
Binary: 11111111.11111111.11111111.00000000
Bitwise NOT: 00000000.00000000.00000000.11111111
Wildcard Mask: 0.0.0.255
Subnet Mask: 255.255.255.192
Binary: 11111111.11111111.11111111.11000000
Bitwise NOT: 00000000.00000000.00000000.00111111
Wildcard Mask: 0.0.0.63
This operation works identically in both directions. Taking the bitwise NOT of a wildcard mask returns the original subnet mask. You can explore the binary representation of any address or mask using our IP to Binary Converter or look at hex values with the Hex IP Converter.
Wildcard masks appear in several key networking contexts. If you manage routers or configure routing protocols, you'll encounter them regularly:
network command under OSPF uses wildcard masks to specify which interfaces participate in the routing process.Here is an example of OSPF and ACL configuration using wildcard masks:
! OSPF: advertise 192.168.1.0/24 into area 0
router ospf 1
network 192.168.1.0 0.0.0.255 area 0
! ACL: permit traffic from 10.0.0.0/8 to any destination
access-list 10 permit 10.0.0.0 0.255.255.255
! Extended ACL: permit HTTP from 172.16.0.0/12
ip access-list extended WEB-TRAFFIC
permit tcp 172.16.0.0 0.15.255.255 any eq 80
Notice the wildcard 0.15.255.255 for the 172.16.0.0/12 range — it covers 172.16.0.0 through 172.31.255.255. If you need to verify the exact IP range, use our IP Range Calculator.
This table covers every standard prefix length from /8 to /32 with the corresponding subnet mask, wildcard mask, and host count. Bookmark this page for quick reference when configuring your gateway or port forwarding rules.
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts |
|---|---|---|---|---|
| /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 |
| /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 |
Even experienced network engineers sometimes make errors when working with wildcard masks. Here are the most frequent pitfalls and how to avoid them:
| Mistake | Example | Correct Approach |
|---|---|---|
| Using subnet mask in ACLs | access-list 10 permit 10.0.0.0 255.0.0.0 | Use wildcard: 10.0.0.0 0.255.255.255 |
| Forgetting host keyword | permit 10.0.0.1 0.0.0.0 | Shorthand: permit host 10.0.0.1 |
| Forgetting any keyword | permit 0.0.0.0 255.255.255.255 | Shorthand: permit any |
| Wrong mask for /12 | 0.0.15.255 instead of 0.15.255.255 | Double check: 255-240 = 15, applies to 2nd octet |
| Mixing up OSPF wildcards | Using /24 mask instead of wildcard | OSPF requires wildcard notation, not CIDR |
When in doubt, use this calculator to verify your mask, then check the resulting network boundaries with our Subnet Calculator. You can also determine whether two hosts are on the same subnet using the Same Subnet Checker.
While wildcard masks are primarily an enterprise concept, understanding them helps when configuring advanced features on home routers. If you access your router at 192.168.1.1 or 10.0.0.1 and see ACL or firewall settings, you may encounter wildcard notation. Your home network likely uses a /24 subnet (255.255.255.0), which has the wildcard mask 0.0.0.255 — meaning all 254 usable host addresses on your LAN are included.
If you're setting up a static IP or configuring DHCP reservations, knowing your wildcard mask helps you understand exactly which addresses fall within your network scope. For DNS configuration, the wildcard mask determines which clients are affected by your rules.
host keyword (wildcard 0.0.0.0) and any keyword (wildcard 255.255.255.255) as shortcuts.A wildcard mask is a 32-bit value used in Cisco IOS and other networking platforms to define which bits of an IP address must match and which can vary. It is the bitwise inverse of a subnet mask. A 0-bit means the corresponding address bit must match, and a 1-bit means it can be anything.
Subtract each octet of the subnet mask from 255. For example, 255.255.255.0 becomes 0.0.0.255 (255-255=0, 255-255=0, 255-255=0, 255-0=255). Alternatively, perform a bitwise NOT operation on the 32-bit mask value.
Cisco ACLs use wildcard masks because they can express non-contiguous bit patterns, which provides more flexibility than subnet masks. For example, a wildcard of 0.0.0.254 matches only even-numbered hosts. While this advanced use is rare, the wildcard format supports it.
The wildcard mask for /32 is 0.0.0.0, meaning every bit must match exactly. In Cisco IOS, you can use the shorthand host 10.0.0.1 instead of writing 10.0.0.1 0.0.0.0. Use our Subnet Calculator to verify any prefix length.
The wildcard mask for matching all addresses is 255.255.255.255 (all "don't care" bits). In Cisco IOS, use the keyword any as a shorthand instead of writing 0.0.0.0 255.255.255.255.
No. IPv6 ACLs in Cisco IOS use prefix-length notation (e.g., 2001:db8::/32) instead of wildcard masks. The wildcard mask concept applies only to IPv4 configurations. For IPv6 work, try our IPv6 Converter.
Yes. OSPF network commands require wildcard masks. Enter your subnet mask here to get the wildcard mask, then use it in your OSPF configuration. For example, if your interface is on 192.168.1.0/24, you need network 192.168.1.0 0.0.0.255 area 0.
About Tommy N.
Tommy is the founder of RouterHax and a network engineer with 10+ years of experience in home and enterprise networking. He specializes in router configuration, WiFi optimization, and network security. When not writing guides, he's testing the latest mesh WiFi systems and helping readers troubleshoot their home networks.
![]() |
![]() |
![]() |
![]() |
Promotion for FREE Gifts. Moreover, Free Items here. Disable Ad Blocker to get them all.
Once done, hit any button as below
![]() |
![]() |
![]() |
![]() |