Wildcard Mask Calculator

Convert a subnet mask to its wildcard mask, or a wildcard mask back to a subnet mask. Commonly needed for Cisco ACLs and OSPF network statements.

Input

Results

Input
—
Result
—
Equivalent CIDR
—
Wildcard masks identify which bits must match and which bits can vary. A wildcard mask is not itself a subnet mask — it is the mask's bitwise inverse, used by ACLs and routing protocols to specify match criteria.

Overview

The Wildcard Mask Calculator converts between a subnet mask (255.255.255.0) and its wildcard mask (0.0.0.255) in either direction. Wildcard masks are what Cisco-style access control lists and OSPF network statements use, and they are a frequent source of configuration mistakes because they look like subnet masks written backwards.

Use it when writing or reviewing an ACL entry, an OSPF network statement, or a route-map match, or when translating a CIDR prefix into the notation a particular device expects.

How It Works

A subnet mask marks which bits identify the network (1s). A wildcard mask answers a different question: which bits may differ when matching an address. A 0 bit means "this bit must match the reference address" and a 1 bit means "ignore this bit". For a contiguous subnet mask, the wildcard is simply the bitwise inverse: each octet is 255 minus the mask octet.

Wildcard masks are more flexible than subnet masks because the 1 bits need not be contiguous. A wildcard of 0.0.255.0 means "match the first, second and fourth octets exactly and ignore the third", which has no CIDR equivalent. For those, the tool still shows the inverse but reports the equivalent CIDR as not applicable.

A wildcard mask is not a subnet mask. It controls matching in ACLs and routing protocols; it is never assigned to an interface.

How to Use the Wildcard Mask Calculator

  1. Enter a dotted mask in the input field, such as 255.255.255.240 or 0.0.0.15.
  2. Leave the direction on Auto-detect for ordinary masks, or choose Subnet Mask → Wildcard or Wildcard → Subnet Mask explicitly.
  3. Press Calculate and read the converted value and the equivalent CIDR prefix.
  4. Paste the wildcard into your configuration, for example access-list 10 permit 192.168.1.0 0.0.0.255.

Worked Example

Writing an ACL entry and an OSPF network statement

You need to match the hosts in 192.168.1.0/28 in an ACL, and advertise 10.1.0.0/21 in OSPF. Both devices want wildcard masks.

Input

Subnet mask: 255.255.255.240   (/28)
Subnet mask: 255.255.248.0     (/21)

Output

255.255.255.240  ->  wildcard 0.0.0.15   (equivalent CIDR /28)
255.255.248.0    ->  wildcard 0.0.7.255    (equivalent CIDR /21)

For the /28, the last octet of the mask is 240, so the wildcard octet is 255 − 240 = 15, giving 0.0.0.15: the first 28 bits must match and the last 4 may vary. The ACL line is access-list 10 permit 192.168.1.0 0.0.0.15.

For the /21, the third octet is 248, so its wildcard octet is 255 − 248 = 7, giving 0.0.7.255. The OSPF statement is network 10.1.0.0 0.0.7.255 area 0. Entering the wildcard 0.0.255.0 instead would show a mask of 255.255.0.255 with no CIDR equivalent, a legitimate but unusual non-contiguous match.

Interpreting Results

Result
The converted mask. If you started with a subnet mask, the result is the wildcard; if you started with a wildcard, it is the subnet mask.
Equivalent CIDR
The prefix length that corresponds to the subnet-mask form. It shows "N/A" when the value is not a contiguous mask.
Zeros and ones
In a wildcard, 0 = must match, 1 = don't care. A wildcard of 0.0.0.0 matches exactly one address; 255.255.255.255 matches everything.

Troubleshooting

My ACL matches too much or nothing.
Check you used a wildcard, not a subnet mask, in the ACL. A line written with 255.255.255.0 instead of 0.0.0.255 matches a very different set of addresses.
Auto-detect picked the wrong direction.
Values such as 0.0.0.0 and 255.255.255.255 are valid as both a mask and a wildcard, so auto-detect treats them as masks. Choose the direction explicitly.
"Please enter a valid dotted-decimal mask."
Four octets, each 0–255, separated by dots. A prefix like /24 is not accepted here; use the Subnet or CIDR calculators for that.

Limitations and Accuracy

  • The tool converts masks only; it does not generate complete ACL lines or check them against a device's syntax.
  • Non-contiguous wildcards are converted but have no CIDR representation, and not all platforms support them.
  • Syntax details such as how a platform treats the wildcard (or whether it uses inverse masks at all) vary by vendor. Confirm against your vendor's documentation.

Data Handling

Runs in your browser. What you enter is processed on your device and is not sent to NetEngToolkit’s servers or to any third party.

Frequently Asked Questions

Why do Cisco ACLs use wildcard masks instead of subnet masks?

The wildcard format lets a single entry match non-contiguous bit patterns and was the convention used by the platforms where ACLs originated. Many other vendors use CIDR notation instead.

How do I convert a wildcard to CIDR quickly?

Invert it to a mask and count the 1 bits. For example 0.0.0.15 inverts to 255.255.255.240, which has 28 ones, so it is a /28.

Is the wildcard of a /32 host 0.0.0.0?

Yes. All 32 bits must match, so the wildcard is 0.0.0.0; many platforms also accept the host keyword.