Wildcard Mask Calculator
Convert subnet mask to wildcard mask (used in ACLs and OSPF configuration).
How to use:
Enter either a subnet mask (e.g., 255.255.255.0) or CIDR notation (e.g., /24) to calculate the corresponding wildcard mask. Wildcard masks are used in access control lists (ACLs) and OSPF network statements.
Published: December 2025 | Author: TriVolt Editorial Team | Last Updated: February 2026
Understanding Wildcard Masks
A wildcard mask is the inverse of a subnet mask, used in network configuration to specify which bits in an IP address should be matched. While subnet masks use 1s to indicate network bits and 0s for host bits, wildcard masks use 0s to indicate bits that must match and 1s for bits that can vary. Wildcard masks are essential for configuring access control lists (ACLs), OSPF network statements, and other network filtering rules.
Wildcard masks provide a flexible way to match IP address ranges. They're particularly useful in ACLs where you need to permit or deny traffic based on source or destination IP addresses. Understanding how to convert between subnet masks and wildcard masks is crucial for network configuration and troubleshooting.
Wildcard Mask Calculation
The wildcard mask is calculated by inverting each octet of the subnet mask:
Wildcard Mask = 255 - Subnet Mask (per octet)
For example, subnet mask 255.255.255.0 becomes wildcard mask 0.0.0.255. Each octet is calculated independently.
Subnet Mask vs. Wildcard Mask
| Subnet Mask | Wildcard Mask | CIDR | Meaning |
|---|---|---|---|
| 255.255.255.0 | 0.0.0.255 | /24 | Match first 24 bits |
| 255.255.0.0 | 0.0.255.255 | /16 | Match first 16 bits |
| 255.255.255.252 | 0.0.0.3 | /30 | Match first 30 bits |
Practical Applications
Access Control Lists (ACLs)
ACLs use wildcard masks to match IP address ranges. For example, to permit traffic from 192.168.1.0/24, you'd use: permit 192.168.1.0 0.0.0.255
OSPF Configuration
OSPF network statements use wildcard masks to specify which interfaces participate in OSPF. For example: network 192.168.1.0 0.0.0.255 area 0
EIGRP Configuration
EIGRP also uses wildcard masks in network statements to specify which networks to advertise.
Route Filtering
Wildcard masks are used in route maps and prefix lists to filter routes based on network addresses.
Real-World Examples
Example 1: ACL for Subnet
Allow traffic from 10.0.0.0/8 network:
Subnet mask: 255.0.0.0
Wildcard mask: 0.255.255.255
ACL: permit 10.0.0.0 0.255.255.255
Example 2: OSPF Network Statement
Include 172.16.0.0/16 network in OSPF:
Subnet mask: 255.255.0.0
Wildcard mask: 0.0.255.255
OSPF: network 172.16.0.0 0.0.255.255 area 0
Important Considerations
Inverse Relationship
Wildcard masks are always the inverse of subnet masks. If you know one, you can calculate the other.
CIDR Conversion
CIDR notation (e.g., /24) can be converted to subnet mask, then to wildcard mask. /24 = 255.255.255.0 = 0.0.0.255 wildcard.
Non-Contiguous Masks
While subnet masks must be contiguous (all 1s followed by all 0s), wildcard masks can be non-contiguous, allowing more flexible matching.
Common Mistake
Don't confuse wildcard masks with subnet masks. Using a subnet mask where a wildcard mask is required (or vice versa) causes incorrect matching.
Tips for Using This Calculator
- Enter subnet mask (e.g., 255.255.255.0) or CIDR notation (e.g., /24)
- Calculator shows subnet mask, CIDR, and wildcard mask
- Use wildcard mask in ACLs and routing protocol configurations
- Remember: wildcard mask is inverse of subnet mask
- 0 in wildcard = must match, 1 in wildcard = can vary
- Always verify critical calculations independently, especially for network security
Common Pitfalls
Pasting a subnet mask where a wildcard is required. On Cisco ACLs and OSPF network statements, 255.255.255.0 is interpreted literally — match only hosts where bits in positions 0 match a pattern — producing an almost-always-fail match. You must write 0.0.0.255. The command-line accepts both silently, so double-check show access-list output before declaring a change successful.
Using non-contiguous wildcards without meaning to. Subnet masks are always contiguous (all 1s, then all 0s). Wildcards are unrestricted — 0.0.0.254 matches only even-numbered hosts, for example. This is useful on purpose but dangerous by accident. If you meant 0.0.0.255 and typed 0.0.0.254, half the subnet silently disappears from the rule.
Inverted interpretation. 0 in a wildcard means "must match"; 1 means "don't care." The opposite of a subnet mask. Engineers coming from firewall vendors that use subnet-style matching (Palo Alto, Fortinet, modern IOS named ACLs) sometimes invert this when switching to Cisco-style ACLs. Always compute via the calculator rather than mentally.
Wrong base address in a wildcard rule. permit ip 10.0.0.0 0.0.0.255 actually matches 10.0.0.0–10.0.0.255 only if the base is an aligned boundary. permit ip 10.0.0.5 0.0.0.255 matches 10.0.0.0–10.0.0.255 too — the wildcard masks the low bits regardless of what you typed. Compare against the Subnet Calculator to see what range the ACL really covers.
Line ordering in ACLs. Wildcard masks control which hosts match a line, but ACL processing is top-down and first-match-wins. A permissive wildcard entry at line 10 blocks a restrictive one at line 20 from ever being evaluated. Always sort most-specific rules to the top.
Frequently Asked Questions
When would I ever want a non-contiguous wildcard?
For matching patterns that can't be expressed as prefixes. The classic example: match all even-numbered hosts on a subnet (last octet even) with wildcard 0.0.0.254 — it requires the low bit to be 0, but the middle six bits can be anything. Another case: match a /24 but skip every fourth host (0.0.0.252). These come up in load-balancer affinity rules and anti-spoofing filters.
Why does OSPF use wildcards instead of subnet masks?
Historical reasons — OSPF's original command-line syntax predates the widespread adoption of prefix notation. Modern IOS accepts prefix-length syntax on some platforms, but the classic network A.B.C.D W.W.W.W area N form uses a wildcard to describe which interfaces participate in the area. Some newer routing operating systems (IOS XR, JunOS) skip the wildcard entirely.
Can I convert any CIDR to a wildcard?
Yes, and the relationship is mechanical: the wildcard is 232−CIDR − 1 as a 32-bit integer, formatted in dotted-decimal. /24 → 255 → 0.0.0.255. /22 → 1023 → 0.0.3.255. /30 → 3 → 0.0.0.3. This calculator handles it both ways — enter a CIDR, get the wildcard (and vice versa).
Does a wildcard of 0.0.0.0 match a single host?
Yes — it matches exactly the base address. permit ip host 10.1.1.5 is equivalent to permit ip 10.1.1.5 0.0.0.0. Both forms appear in Cisco ACLs; the host keyword is the modern shorthand.
Does this apply to iptables or nftables?
No — Linux netfilter uses standard CIDR prefixes (-s 10.0.0.0/24), not wildcards. Wildcards are primarily Cisco ACL / EIGRP / OSPF syntax. JunOS uses prefix notation in firewall filters. If you're writing iptables rules, skip this calculator and use the Subnet Calculator for CIDR ranges instead.
Related Calculators
Combine wildcards with these network tools:
- Subnet Calculator — convert CIDR to subnet mask, then to wildcard.
- Supernet Calculator — aggregate multiple networks into a single wildcard-friendly prefix.
- VLSM Calculator — plan ACL coverage for each subnet in a VLSM scheme.
- IP Converter — view addresses in binary to understand wildcard matching bit-by-bit.
- Bandwidth Calculator — estimate throughput permitted by your ACL rules.
Disclaimer
This calculator is provided for educational and informational purposes only. While we strive for accuracy, users should verify all calculations independently, especially for critical applications. We are not responsible for any errors, omissions, or damages arising from the use of this calculator.
Also in Technical
- → ACL Wildcard Tester — Test whether IPs match a Cisco ACL wildcard mask. Step-by-step binary breakdown and multi-IP match table.
- → Bandwidth Calculator — Calculate data transfer time, throughput, and bandwidth requirements
- → Base64 Encoder/Decoder — Encode and decode Base64 strings
- → Color Code Converter — Convert between HEX, RGB, and HSL color formats