Wildcard mask calculator
Convert a prefix, a subnet mask and a wildcard mask, and get the lines to paste into an ACL or an OSPF network statement.
More in IP and subnets · Subnets and ranges
What the calculator does
Type a prefix (/27), a subnet mask (255.255.255.224), a wildcard mask (0.0.0.31), a hex mask (0xffffffe0), 32 binary digits or a block (192.168.1.32/27). The page says which one it understood, then gives the other forms, how many addresses and usable hosts the mask has, and the 32 bits with the ones that must match and the ones that can be anything marked.
A wildcard mask is the inverse of a subnet mask: a 0 bit must match and a 1 bit can be anything. Wildcard masks are used in Cisco ACLs and OSPF network statements. Interfaces take the subnet mask.
How to use it
- Convert a valueType any of the forms above.
0.0.0.0and255.255.255.255can be a mask or a wildcard: we read a value that starts with 255 as a mask and one that starts with 0 as a wildcard, and the other reading is one link away. - Check an addressUnder More options, add an address to see the network and broadcast address it falls in, or, for a wildcard that is not one subnet, addresses that match it and one that does not.
- Cover a rangeAdd a range such as
192.168.1.10 - 192.168.1.77to get the shortest list of address and wildcard pairs that match exactly that range, with the ACL lines for it. That range takes 7 pairs for 68 addresses.
Wildcards that are not one subnet
An ACL wildcard does not have to be one block of bits. 0.0.254.255 with the address 10.1.1.0 matches every address 10.1.x.y where x is odd: the lowest bit of the third octet must match, and every other bit of the last two octets can be anything. That is 15 free bits, 32,768 addresses. As a mask, 0.0.254.255 is not valid, because its 1 bits are not together; as a wildcard it is. The page generates the plain sentence from the bits, never from a list of cases.
A subnet mask is always a run of 1 bits followed by 0 bits. 255.0.255.0 is not one, and the page says so, then offers to read it as a wildcard instead. IPv6 does not use masks written like this: a length above 32 is read as an IPv6 prefix and the page points to the subnet calculator.
Subnet mask and wildcard cheat sheet, /0 to /32
Exact for IPv4. A /31 has 2 addresses and both are usable on a point-to-point link (RFC 3021). A /32 is one host.
| Prefix | Subnet mask | Wildcard | Addresses | Usable hosts |
|---|---|---|---|---|
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 | 510 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 | 1,022 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 | 2,046 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 | 8,190 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 | 16,382 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 | 32,766 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 | 131,070 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 | 262,142 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 | 524,286 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 | 1,048,574 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 | 2,097,150 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /7 | 254.0.0.0 | 1.255.255.255 | 33,554,432 | 33,554,430 |
| /6 | 252.0.0.0 | 3.255.255.255 | 67,108,864 | 67,108,862 |
| /5 | 248.0.0.0 | 7.255.255.255 | 134,217,728 | 134,217,726 |
| /4 | 240.0.0.0 | 15.255.255.255 | 268,435,456 | 268,435,454 |
| /3 | 224.0.0.0 | 31.255.255.255 | 536,870,912 | 536,870,910 |
| /2 | 192.0.0.0 | 63.255.255.255 | 1,073,741,824 | 1,073,741,822 |
| /1 | 128.0.0.0 | 127.255.255.255 | 2,147,483,648 | 2,147,483,646 |
| /0 | 0.0.0.0 | 255.255.255.255 | 4,294,967,296 | 4,294,967,294 |
Questions people ask
What is a wildcard mask?
The inverse of a subnet mask. In a wildcard, a 0 bit means the address bit must match and a 1 bit means it can be anything. 0.0.0.31 matches 32 addresses in a row.
How do I turn a subnet mask into a wildcard mask?
Subtract each octet from 255. 255.255.255.224 becomes 0.0.0.31. The calculator does this for any prefix, mask, hex or binary value.
Can a wildcard mask match addresses that are not in one subnet?
Yes. A Cisco ACL wildcard such as 0.0.254.255 matches every odd third octet. The page shows how many addresses it matches and gives the sentence from its bits.
Why does a /31 show 2 usable hosts?
On a point-to-point link a /31 needs no network or broadcast address (RFC 3021), so both addresses are usable. The calculator says so instead of showing 0.
Use it from AI, the API or the command line
Every LookupOwl tool is also a free API and an MCP tool, with no key and no account. This one is netmask_convert. Please be kind to the rate limits.
curl "https://lookupowl.com/api/v1/tools/netmask-convert?q=%2F27&address=192.168.1.40"claude mcp add --transport http lookupowl https://lookupowl.com/mcp