Wildcard Mask Calculator
Convert subnet masks to wildcard masks for ACLs and OSPF.
Example ACL line: access-list 10 permit 10.0.0.0 0.0.0.255
About this tool
Free wildcard mask calculator. Convert a subnet mask or CIDR prefix to the inverse (wildcard) mask used in Cisco ACLs and OSPF network statements, and back again — with binary view. Everything runs entirely in your browser — nothing you type is sent to a server.
Cisco ACLs and OSPF network statements use wildcard masks instead of subnet masks. A wildcard is the bit-inverse of the mask: 0 means 'this bit must match', 1 means 'ignore this bit'. For contiguous masks you get it by subtracting each octet of the mask from 255.
How to use the Wildcard Mask Calculator
- Enter a subnet mask (
255.255.255.224) or a prefix length (/27). - Read the wildcard mask and the binary view.
- Or enter a wildcard to convert it back to a mask.
- Use the result in your ACL or OSPF statement.
Example: /27 in an ACL and OSPF
For 192.168.1.0/27, the mask is 255.255.255.224 and the wildcard is 0.0.0.31 (255 - 224 = 31):
access-list 10 permit 192.168.1.0 0.0.0.31 router ospf 1 network 192.168.1.0 0.0.0.31 area 0
Wildcards do not have to be contiguous. 10.0.0.0 0.0.254.255 matches every 10.0.X.Y where X is even, because the lowest bit of the third octet must be 0. That trick is powerful but hard to read, so document it.
How wildcard matching works
A router compares an address with an ACL entry bit by bit. Where the wildcard has a 0, the address bit must equal the entry's bit; where it has a 1, the bit is ignored. For a contiguous mask this is exactly the inverse of the subnet mask, so it matches a subnet.
OSPF network statements use the same logic to decide which interfaces join the process. network 10.1.1.0 0.0.0.255 area 0 enables OSPF on every interface whose primary address is in 10.1.1.0/24. Many engineers instead write one statement per interface address with wildcard 0.0.0.0, or configure OSPF directly on the interface, to avoid accidentally enabling it on interfaces added later.
Reading the results
- Wildcard mask
- 255 minus each octet of the subnet mask, for contiguous masks.
- Binary
- Shows which bits must match (0) and which are ignored (1).
Common mistakes
- Writing the subnet mask in an ACL, such as
permit 192.168.1.0 255.255.255.0. On IOS that matches almost anything with .0 in the last octet, not the subnet. - Using wildcards on platforms that expect masks or prefixes, such as many ASA and NX-OS commands.
- Forgetting that
host 10.1.1.1is shorthand for10.1.1.1 0.0.0.0andanyfor0.0.0.0 255.255.255.255.
Frequently asked questions
What is the wildcard mask for /24?
0.0.0.255.
Is a wildcard mask the same as an inverse mask?
Yes, for contiguous masks. Wildcards can also be non-contiguous, which subnet masks cannot.
Do Juniper and FortiGate use wildcard masks?
Generally no. Junos and FortiOS use prefixes or subnet masks; wildcards are mostly a Cisco IOS convention.