Updated
Convert between subnet masks, prefixes and wildcard masks, turn an address range into ACL lines, and test a packet against a Cisco IOS access list to see which line it hits. It runs in your browser.
0 = must match 1 = ignored
Enter the first and last address. You get the fewest address and wildcard pairs that cover exactly that range, nothing more.
| Block | Address and wildcard | Addresses |
|---|
Paste Cisco IOS ACL lines: numbered (access-list 101 permit tcp ...), a named ACL (ip access-list extended NAME and its permit / deny lines), or show access-lists output. Then describe a packet.
In NetworkSketch you draw the routers, firewalls and VLANs they protect, with each subnet and its gateway on the diagram. Work out the subnets first with the subnet calculator, and look up ports in the port numbers reference.
A wildcard mask tells a Cisco router which bits of an address to check. A 0 bit means the bit must match; a 1 bit means ignore it. So 10.1.0.0 0.0.255.255 means "the first two octets must be 10.1, the last two can be anything": all of 10.1.0.0 to 10.1.255.255.
For a normal subnet the wildcard is the subnet mask with every bit flipped, which is why people call it an inverse mask. ACLs, OSPF and EIGRP network statements, and some route maps use wildcards; interface addresses and routes use subnet masks.
Subtract the subnet mask from 255.255.255.255, one octet at a time:
255.255.255.255 - 255.255.252.0 (/22) = 0.0.3.255
Going the other way works the same: 255.255.255.255 minus the wildcard gives the mask. The number of addresses a wildcard matches is 2 to the power of its 1 bits: 0.0.3.255 has ten, so it matches 1,024 addresses.
Wildcards don't have to be contiguous. 0.0.254.255 ignores every bit of the third octet except the lowest, so with 10.1.1.0 it matches the odd third octets only (10.1.1.x, 10.1.3.x ... 10.1.255.x). That is legal in an ACL, but it isn't a subnet, so there is no mask or prefix for it.
| Prefix | Subnet mask | Wildcard mask | Addresses |
|---|---|---|---|
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 |
| /11 | 255.224.0.0 | 0.31.255.255 | 2,097,152 |
| /12 | 255.240.0.0 | 0.15.255.255 | 1,048,576 |
| /13 | 255.248.0.0 | 0.7.255.255 | 524,288 |
| /14 | 255.252.0.0 | 0.3.255.255 | 262,144 |
| /15 | 255.254.0.0 | 0.1.255.255 | 131,072 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 |
| /17 | 255.255.128.0 | 0.0.127.255 | 32,768 |
| /18 | 255.255.192.0 | 0.0.63.255 | 16,384 |
| /19 | 255.255.224.0 | 0.0.31.255 | 8,192 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 |
| /21 | 255.255.248.0 | 0.0.7.255 | 2,048 |
| /22 | 255.255.252.0 | 0.0.3.255 | 1,024 |
| /23 | 255.255.254.0 | 0.0.1.255 | 512 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 |
network 10.1.0.0 0.0.255.255 area 0 under router ospf turns OSPF on for every interface whose IP address falls in 10.1.0.0 to 10.1.255.255, and puts those interfaces in area 0. The wildcard picks interfaces; it doesn't set the prefix that gets advertised, which comes from each interface's own mask. To pick exactly one interface, use its address with 0.0.0.0: network 10.1.1.1 0.0.0.0 area 0. EIGRP network statements read wildcards the same way.
A router checks an ACL from the top and stops at the first line that matches: that line's permit or deny is the answer, and nothing below it is read. If no line matches, the packet hits the implicit deny at the end, which isn't shown in the config. So:
deny lines blocks everything. Finish it with permit ip any any (extended) or permit any (standard) if you only meant to block some traffic.deny ip any any log at the end if you want to see what the implicit deny drops.IOS clears address bits under a wildcard's 1s: access-list 10 permit 10.1.1.5 0.0.0.255 is stored as 10.1.1.0 0.0.0.255. The tester reads lines the same way. It checks each line against the lines above it one at a time, so a line covered only by several earlier lines together isn't flagged.
Subtract each octet of the subnet mask from 255. For 255.255.252.0 (/22): 255-255, 255-255, 255-252, 255-0 gives 0.0.3.255. In binary, every 1 in the mask becomes a 0 in the wildcard and every 0 becomes a 1.
0.0.0.255. The first three octets must match and the last octet can be anything, so 192.168.1.0 0.0.0.255 matches 192.168.1.0 to 192.168.1.255.
Yes, in Cisco ACLs. 10.1.1.0 0.0.254.255 matches every 10.1.x.y address whose third octet is odd, because the lowest bit of the third octet must match and the rest are ignored. A non-contiguous wildcard has no subnet mask or prefix length, so it can't describe a subnet.
Every IOS ACL ends with an implicit deny that isn't shown in the configuration. A packet that matches no line is dropped. An ACL with only deny lines blocks everything, so end it with permit ip any any (extended) or permit any (standard) if you only meant to block a few things.
No. The calculator and ACL tester run on this page in your browser, and the page has no analytics or tracking. Your inputs are kept in the part of the link after the # so you can share them, and browsers never send that part to the server.