Free tech learning for everyone, from basics to pro

Wildcard mask calculator

Convert a prefix or subnet mask to the wildcard mask used in ACLs and OSPF.

Runs on your device · nothing is uploaded

What is a wildcard mask?

A wildcard mask is the opposite of a subnet mask: every 0 bit means "must match" and every 1 bit means "any value". Cisco access lists and OSPF network statements use them. The quick way to work one out is to subtract each octet of the subnet mask from 255.

PrefixSubnet maskWildcard
/24255.255.255.00.0.0.255
/27255.255.255.2240.0.0.31
/30255.255.255.2520.0.0.3

Where wildcard masks are used

  • Access lists: access-list 10 permit 192.168.10.0 0.0.0.255 matches every address from 192.168.10.0 to 192.168.10.255.
  • OSPF: network 10.1.1.0 0.0.0.255 area 0 enables OSPF on interfaces in that range.
  • Shortcuts: 0.0.0.0 matches one exact address (the host keyword), and 255.255.255.255 matches anything (the any keyword).

A worked example

For 192.168.20.64/26, the subnet mask is 255.255.255.192. Subtract each octet from 255: 255−255, 255−255, 255−255, 255−192. The wildcard mask is 0.0.0.63, so the ACL line is permit 192.168.20.64 0.0.0.63, matching .64 to .127.

Beyond subnet masks

Wildcards don't have to be a neat block of 1s. 10.0.0.0 0.0.254.255 matches every 10.0.x.y address where x is even, because the last bit of the third octet must be 0. It is clever, but hard to read; most teams avoid it in production.

Common mistakes

  • Typing the subnet mask (255.255.255.0) where IOS expects a wildcard. In an ACL that matches almost nothing you intended.
  • Forgetting the implicit "deny any" at the end of every ACL.
  • Putting a broad permit above a specific deny. ACLs are read top to bottom and stop at the first match.

Practise with our ACLs and wildcard masks note and the ACL builder tool.

Get free updates by email

New notes, tools, CCNA and Security+ tips and important security news from FM TecHub, explained simply. Free, about twice a month. Unsubscribe anytime; see our privacy policy.

PortServiceStatus
SMTP/25Email updatesup

Free · no spam · past emails · powered by Buttondown