IP Tools

Wildcard Mask Calculator

Convert a subnet mask or prefix into the wildcard mask used in Cisco access lists and OSPF.

Jump to tool

What Is a Wildcard Mask?

A wildcard mask is the inverse of a subnet mask, used mainly in Cisco access control lists and OSPF configuration. Where a subnet mask has 1 bits the wildcard has 0 bits, so the /24 mask 255.255.255.0 becomes the wildcard 0.0.0.255, meaning the last octet can be anything.

The tool inverts the bits of the subnet mask you give it to produce the matching wildcard mask.

How to Calculate a Wildcard Mask

  1. Enter an IP address and its CIDR prefix or subnet mask.
  2. Select Calculate.
  3. Use the wildcard mask in your access list, for example 0.0.0.255 for a /24 network.

The Method

Subtract each octet of the subnet mask from 255. For 255.255.255.224, that gives 0.0.0.31. In a wildcard mask, 0 means 'must match' and 1 means 'any value'.

Quick Reference

PrefixSubnet mask → wildcard mask
/8255.0.0.0 → 0.255.255.255
/16255.255.0.0 → 0.0.255.255
/20255.255.240.0 → 0.0.15.255
/22255.255.252.0 → 0.0.3.255
/24255.255.255.0 → 0.0.0.255
/25255.255.255.128 → 0.0.0.127
/26255.255.255.192 → 0.0.0.63
/27255.255.255.224 → 0.0.0.31
/28255.255.255.240 → 0.0.0.15
/29255.255.255.248 → 0.0.0.7
/30255.255.255.252 → 0.0.0.3
/32255.255.255.255 → 0.0.0.0

Where Wildcard Masks Are Used

ConfigurationExample
Standard access listaccess-list 10 permit 192.168.1.0 0.0.0.255
Extended access listaccess-list 110 permit tcp 10.0.0.0 0.0.0.255 any eq 443
OSPF network statementnetwork 10.0.0.0 0.0.0.255 area 0
Match one host192.168.1.10 0.0.0.0, or the keyword host

Wildcard Mask Calculator FAQ

Need the subnet mask first?

Convert between prefixes and subnet masks.

Subnet Mask Calculator