Wildcard mask calculator
Turn a subnet mask or prefix into a wildcard (inverse) mask, or the other way round, and get ready-to-paste Cisco ACL and OSPF lines.
| Wildcard mask | 0.0.15.255 |
|---|---|
| Subnet mask | 255.255.240.0 (/20) |
| Wildcard binary | 00000000.00000000.00001111.11111111 |
| Matches | 4,096 addresses |
Cisco IOS
access-list 10 permit 10.10.16.0 0.0.15.255 ip access-list extended ALLOW-NET permit ip 10.10.16.0 0.0.15.255 any router ospf 1 network 10.10.16.0 0.0.15.255 area 0
Wildcard masks vs subnet masks
| Prefix | Subnet mask | Wildcard |
|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 |
| /16 | 255.255.0.0 | 0.0.255.255 |
| /20 | 255.255.240.0 | 0.0.15.255 |
| /22 | 255.255.252.0 | 0.0.3.255 |
| /23 | 255.255.254.0 | 0.0.1.255 |
| /24 | 255.255.255.0 | 0.0.0.255 |
| /25 | 255.255.255.128 | 0.0.0.127 |
| /26 | 255.255.255.192 | 0.0.0.63 |
| /27 | 255.255.255.224 | 0.0.0.31 |
| /28 | 255.255.255.240 | 0.0.0.15 |
| /29 | 255.255.255.248 | 0.0.0.7 |
| /30 | 255.255.255.252 | 0.0.0.3 |
| /32 | 255.255.255.255 | 0.0.0.0 |
Router ACLs compare a packet's address with the ACL address only on bits where the wildcard is 0. That's why the inverse is used: it describes what to ignore. The full table of every prefix is on the subnet cheat sheet.
Questions people ask
What is a wildcard mask?
The bitwise inverse of a subnet mask, used by Cisco ACLs and OSPF/EIGRP network statements. A 0 bit means "must match", a 1 bit means "don't care". 255.255.255.0 becomes 0.0.0.255.
How do I calculate a wildcard mask quickly?
Subtract each octet of the subnet mask from 255. For 255.255.240.0: 255−255, 255−255, 255−240, 255−0 = 0.0.15.255.
Can wildcard masks be non-contiguous?
Yes, unlike subnet masks. 0.0.254.255 on 10.0.1.0 matches every odd third octet (10.0.1.x, 10.0.3.x…). It's legal in ACLs but hard to read; this calculator flags non-contiguous masks.
What do "host" and "any" mean in an ACL?
host 10.1.1.1 is shorthand for wildcard 0.0.0.0 (match exactly one address); any is 0.0.0.0 255.255.255.255 (match everything).