Wildcard mask calculator

Enter a subnet mask, a wildcard mask or a prefix length. The calculator detects which one it is, converts it, and writes the Cisco ACL and OSPF lines for you.

Private: works in your browser, nothing is uploaded.

How to use the Wildcard Mask Calculator tool

  1. Type a mask (255.255.255.0), a wildcard (0.0.0.255) or a prefix (/24).
  2. Optionally enter the network address to get ACL and routing examples.
  3. Copy the line you need into your configuration.

What a wildcard mask is

A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask has 1s for the network part, the wildcard has 0s, meaning “this bit must match”, and 1s meaning “this bit can be anything”. The quick way to compute it: subtract each octet of the subnet mask from 255. So 255.255.255.0 becomes 0.0.0.255, and 255.255.255.224 becomes 0.0.0.31.

Cisco IOS uses wildcard masks in access control lists and in the network statements of OSPF and EIGRP. Getting one wrong is a classic mistake: writing 255.255.255.0 where a wildcard is expected means “match anything in the first three octets and only .0 in the last”, which is almost never what you want.

Non-contiguous wildcards

Unlike subnet masks, wildcards do not have to be a continuous run of bits. A wildcard of 0.0.254.255 matches every even third octet, which can select, for example, all even-numbered VLAN subnets with one ACL line. The calculator recognises such masks and shows their binary form. They are powerful but hard to read, so document them well.

Tips from network practice

  • Use host 10.1.1.1 instead of 10.1.1.1 0.0.0.0: it is the same thing and easier to read.
  • In OSPF, the wildcard in the network statement only selects interfaces. It does not change the mask that is advertised.
  • Remember the implicit “deny any” at the end of every ACL.
  • Newer platforms (IOS XE named ACLs, NX-OS, ASA) often accept prefix notation; check before converting.

Privacy

Everything runs in your browser. Nothing you type is sent to our server or stored.

Wildcard mask table: /8 to /32

PrefixSubnet maskWildcard maskAddresses
/8255.0.0.00.255.255.25516,777,216
/9255.128.0.00.127.255.2558,388,608
/10255.192.0.00.63.255.2554,194,304
/11255.224.0.00.31.255.2552,097,152
/12255.240.0.00.15.255.2551,048,576
/13255.248.0.00.7.255.255524,288
/14255.252.0.00.3.255.255262,144
/15255.254.0.00.1.255.255131,072
/16255.255.0.00.0.255.25565,536
/17255.255.128.00.0.127.25532,768
/18255.255.192.00.0.63.25516,384
/19255.255.224.00.0.31.2558,192
/20255.255.240.00.0.15.2554,096
/21255.255.248.00.0.7.2552,048
/22255.255.252.00.0.3.2551,024
/23255.255.254.00.0.1.255512
/24255.255.255.00.0.0.255256
/25255.255.255.1280.0.0.127128
/26255.255.255.1920.0.0.6364
/27255.255.255.2240.0.0.3132
/28255.255.255.2400.0.0.1516
/29255.255.255.2480.0.0.78
/30255.255.255.2520.0.0.34
/31255.255.255.2540.0.0.12
/32255.255.255.2550.0.0.01

Example ACL

To allow the subnet 10.20.30.0/26 to reach a server on port 443: permit tcp 10.20.30.0 0.0.0.63 host 10.0.0.10 eq 443. The wildcard 0.0.0.63 is 255.255.255.255 minus the mask 255.255.255.192. Remember to place more specific lines before broader ones, because ACLs are read from top to bottom.

Frequently asked questions

What is the wildcard mask for /24?

0.0.0.255.

What is the wildcard mask for 255.255.255.252?

0.0.0.3, which matches a /30 point-to-point link.

Is a wildcard mask the same as a host mask?

Yes, “inverse mask” and “host mask” are other names for the same thing.

Do Juniper or Linux use wildcard masks?

Rarely. Juniper and Linux firewalls (iptables, nftables) use prefix notation. Wildcards are mainly a Cisco convention.

How do I calculate a wildcard mask by hand?

Subtract each octet of the subnet mask from 255. For 255.255.255.224: 255−255, 255−255, 255−255, 255−224 gives 0.0.0.31.

What is the wildcard mask for /27, /28 and /29?

/27 is 0.0.0.31, /28 is 0.0.0.15 and /29 is 0.0.0.7.

Is the calculation done online?

No. It runs in your browser.

What wildcard matches a single host?

0.0.0.0, or simply use the host keyword.