Wildcard Mask Calculator

About Wildcard Mask Calculator

A wildcard mask, often used in conjunction with access control lists (ACLs) in networking, is a 32-bit pattern used to specify which bits in an IP address should be ignored when determining whether a packet matches the criteria specified in the ACL. It's essentially the opposite of a subnet mask, where 1s in the wildcard mask indicate bits to be ignored, and 0s indicate bits that must match exactly.

Here's an example to illustrate: Let's say you have an ACL rule that you want to apply to all IP addresses in the range 192.168.1.0 to 192.168.1.255, except for 192.168.1.100 and 192.168.1.200. To create an ACL rule for this, you would need to specify a wildcard mask that matches the range you want to include and excludes the specific addresses you want to exclude.

The subnet mask for the range 192.168.1.0/24 is 255.255.255.0. To create a wildcard mask for this range:

  • Determine the binary representation of the subnet mask: 255.255.255.0 => 11111111.11111111.11111111.00000000
  • Invert the bits (change 0s to 1s and 1s to 0s) to create the wildcard mask: Wildcard mask = 00000000.00000000.00000000.11111111

So, the wildcard mask for the range 192.168.1.0/24 is 0.0.0.255.

To exclude the addresses 192.168.1.100 and 192.168.1.200, you would set specific bits in the wildcard mask to 0 to indicate that they must match exactly:

  • For 192.168.1.100: The binary representation is 11000000.10101000.00000001.01100100, so the wildcard mask for this address would be 0.0.0.0.
  • For 192.168.1.200: The binary representation is 11000000.10101000.00000001.10010000, so the wildcard mask for this address would also be 0.0.0.0.

So, the ACL rule with the wildcard mask 0.0.0.255 would match all IP addresses in the range
192.168.1.0 to 192.168.1.255, except for 192.168.1.100 and 192.168.1.200.

Wildcard Mask Table

Subnet Mask / Bits Wildcard Mask
128.0.0.0 / 1 127.255.255.255
192.0.0.0 / 2 63.255.255.255
224.0.0.0 / 3 31.255.255.255
240.0.0.0 / 4 15.255.255.255
248.0.0.0 / 5 7.255.255.255
252.0.0.0 / 6 3.255.255.255
254.0.0.0 / 7 1.255.255.255
255.0.0.0 / 8 0.255.255.255
255.128.0.0 / 9 0.127.255.255
255.192.0.0 / 10 0.63.255.255
255.224.0.0 / 11 0.31.255.255
255.240.0.0 / 12 0.15.255.255
255.248.0.0 / 13 0.7.255.255
255.252.0.0 / 14 0.3.255.255
255.254.0.0 / 15 0.1.255.255
255.255.0.0 / 16 0.0.255.255
255.255.128.0 / 17 0.0.127.255
255.255.192.0 / 18 0.0.63.255
255.255.224.0 / 19 0.0.31.255
255.255.240.0 / 20 0.0.15.255
255.255.248.0 / 21 0.0.7.255
255.255.252.0 / 22 0.0.3.255
255.255.254.0 / 23 0.0.1.255
255.255.255.0 / 24 0.0.0.255
255.255.255.128 / 25 0.0.0.127
255.255.255.192 / 26 0.0.0.63
255.255.255.224 / 27 0.0.0.31
255.255.255.240 / 28 0.0.0.15
255.255.255.248 / 29 0.0.0.7
255.255.255.252 / 30 0.0.0.3
255.255.255.254 / 31 0.0.0.1
255.255.255.255 / 32 0.0.0.0