Wildcard Mask Calculator - Inverse Subnet Mask Converter
← Back to Main Calculator

Wildcard Mask Calculator

Calculate wildcard masks for ACLs and OSPF configurations.

Subnet Mask Lookup & Wildcard Reference

CIDRSubnet MaskWildcard MaskUsable Hosts
Networking Guide

Wildcard Masks: The Key to Flexible Network Access Control

A wildcard mask is a fundamental tool in Cisco networking used to define which parts of an IP address to match and which to ignore. While subnet masks identify the boundary between network and host portions, wildcard masks serve a different purpose—they give network engineers the ability to create flexible rules for access control lists (ACLs) and routing protocols like OSPF. Understanding wildcard masks is essential for anyone who configures network security, filters traffic, or manages routing on Cisco devices.

What Is a Wildcard Mask and How Does It Work?

A wildcard mask is a 32-bit number written in dotted decimal notation, just like a subnet mask. However, the meaning of the bits is inverted. In a wildcard mask, a 0 in a bit position means the corresponding bit in the IP address must match exactly. A 1 means the bit is ignored or wildcarded—it can be either 0 or 1. This inversion may seem confusing at first, but it is what gives wildcard masks their power and flexibility. For example, a wildcard mask of 0.0.0.255 tells the router to match the first three octets exactly and ignore the last octet, effectively matching an entire /24 subnet.

The simplest way to calculate a wildcard mask is to subtract each octet of the subnet mask from 255. For a subnet mask of 255.255.255.0, subtract from 255 to get 0.0.0.255. For 255.255.255.252 (/30), subtract from 255 to get 0.0.0.3. For 255.255.0.0 (/16), you get 0.0.255.255. You can also compute the wildcard mask by taking the bitwise NOT of the subnet mask. This calculator performs both calculations instantly, converting any CIDR prefix or subnet mask to its corresponding wildcard mask and showing the details in a clear reference table.

Wildcard Masks in Access Control Lists

The most common use of wildcard masks is in Cisco ACLs. An ACL entry consists of a permit or deny action, an IP address, and a wildcard mask. The combination tells the router exactly which traffic to match. For example, the ACL entry access-list 10 permit 192.168.1.0 0.0.0.255 permits all traffic from the 192.168.1.0/24 network. If you wanted to permit only a single host, you would use access-list 10 permit 192.168.1.100 0.0.0.0, where the wildcard mask 0.0.0.0 means every bit must match exactly. The keyword host can be used as shorthand: access-list 10 permit host 192.168.1.100.

Wildcard masks also support non-contiguous matching, which is something subnet masks cannot do. For example, a wildcard mask of 0.0.3.255 can match specific combinations of addresses across different subnets by matching only certain bits in the third octet. This flexibility is particularly useful in complex network environments with discontinuous address ranges. However, non-contiguous wildcard masks require careful planning to avoid unintended matches. The reference table on this calculator makes it easy to verify the exact range that any wildcard mask will match.

Wildcard Masks in OSPF Routing

In OSPF configuration, wildcard masks are used in the network command to tell the router which interfaces should participate in the OSPF routing process. The syntax is network [IP] [wildcard-mask] area [area-id]. For example, network 192.168.1.0 0.0.0.255 area 0 tells OSPF to enable routing on any interface whose IP address falls within the 192.168.1.0/24 subnet. The wildcard mask ensures that only interfaces matching the specified addresses are included, giving administrators precise control over OSPF participation.

In both ACLs and OSPF, getting the wildcard mask right is critical. An incorrect wildcard mask can either block legitimate traffic, allow unauthorized access, or cause routing protocols to fail. The most common mistake is confusing wildcard masks with subnet masks—remember that 0 means must-match and 1 means ignore, which is the opposite of a subnet mask. The wildcard mask calculator provides a complete reference from /0 to /32, showing the subnet mask, wildcard mask, and usable hosts for every prefix length. Bookmark this page for quick reference during router configuration or CCNA exam preparation.

Wildcard masks may seem confusing at first, but once you understand the 0=must-match, 1=ignore rule, they become an intuitive and powerful tool for IP address matching. Whether you are securing a network with ACLs or configuring OSPF across multiple subnets, the wildcard mask is essential for precise, flexible network control.



Frequently Asked Questions

What is a wildcard mask used for?

A wildcard mask is used in Cisco ACLs (Access Control Lists) and OSPF (Open Shortest Path First) routing protocols to specify which bits of an IP address must match exactly and which bits can be ignored. In ACLs, it determines which source or destination IP addresses are permitted or denied. In OSPF, it is used in the network statement to tell the router which interfaces should participate in the OSPF routing process.

How to get a wildcard mask?

To calculate a wildcard mask, subtract each octet of the subnet mask from 255. For example, a subnet mask of 255.255.255.0 becomes a wildcard mask of 0.0.0.255. A /24 CIDR prefix gives a wildcard mask of 0.0.0.255, a /16 gives 0.0.255.255, and a /30 gives 0.0.0.3. You can also use the formula: wildcard = ~subnet_mask (bitwise NOT). This calculator automatically converts any CIDR or subnet mask to its corresponding wildcard mask.

What is the point of a wildcard mask?

The point of a wildcard mask is to provide flexible IP address matching for ACL rules and routing protocols. Unlike a subnet mask which identifies network vs host bits, a wildcard mask uses 0 to mean must-match and 1 to mean ignore. This allows network administrators to match a range of IP addresses with precision. For example, 0.0.0.255 matches any host in a /24 subnet, and 0.0.3.255 can match a carefully selected set of addresses across multiple subnets.

Why do ACLs use wildcard masks?

ACLs use wildcard masks because they offer greater matching flexibility compared to subnet masks. With a wildcard mask, you can match an exact IP address (0.0.0.0), an entire subnet (0.0.0.255 for /24), or even non-contiguous address patterns that would be impossible with a subnet mask. This flexibility allows network engineers to create precise traffic filtering rules—for example, permitting traffic from a specific range of hosts while denying others.

What is a /30 wildcard mask?

A /30 CIDR prefix corresponds to a subnet mask of 255.255.255.252 and a wildcard mask of 0.0.0.3. This wildcard mask matches the last 2 bits of the IP address (since 3 in binary is 00000011), meaning the first 30 bits must match and the last 2 bits can vary. A /30 wildcard mask is used in ACLs to match point-to-point link addresses, where only 4 addresses exist in the subnet (network, two usable, broadcast).