Packet Path/

Wildcard Masks Explained: The Backwards Mask in Every ACL

A wildcard mask looks like a subnet mask written backwards — because it is. Where a subnet mask uses 1 bits to mean this part is the network, a wildcard mask uses 0 bits to mean this part must match and 1 bits to mean do not care. That one flip is the whole idea behind every Cisco ACL line and every OSPF network statement, and getting it backwards is one of the most common — and most dangerous — beginner mistakes in networking. This guide converts, decodes, and reads wildcard masks bit by bit, with worked host and range examples you can check yourself.

Fundamentals · Beginner · 10 min · November 8, 2026

Editorial illustration on a dark teal background: a stencil with some squares cut out and some covered, held over a row of glowing address tiles, with the covered squares dimmed and the cut-out squares lit.

The short answer

What is a wildcard mask? It is a 32-bit mask used in Cisco access lists (ACLs) and in OSPF network statements that tells the router which bits of an address it must check and which bits it may ignore. A 0 bit means must match. A 1 bit means do not care. So the pair 192.168.1.0 0.0.0.255 means: check the first 24 bits against 192.168.1, and ignore the last 8 bits completely — any final number from 0 to 255 is a match. That is the entire mechanism. Everything else in this guide is learning to read and write those pairs quickly, and to spot the one mistake that turns a careful rule into a wide-open door.

Think of a stencil laid over a row of house numbers. Where the stencil is solid, the number underneath must be exactly the one printed on the stencil. Where the stencil has a hole cut out, anything underneath shows through and is accepted. A subnet mask and a wildcard mask are two stencils that describe the same street in opposite ways: the subnet mask marks the network part, the wildcard mask marks the part you are free to ignore. Once you see it as a stencil, the backwards feeling disappears — the mask is not describing the network, it is describing what the check cares about.

In plain EnglishACL (access control list): a list of permit/deny rules on a router or firewall, read top to bottom, first match wins. Subnet mask: the mask that splits an address into network part and host part, like 255.255.255.0 for a /24. Wildcard mask: the inverted mask used in ACLs and OSPF, like 0.0.0.255 for that same /24. Octet: one of the four numbers in an IPv4 address, each 0 to 255. Bit: a single 0 or 1 inside an octet — an octet is eight bits.
One ACL pair, decoded: must match, must match, must match, do not care Address: 192 Wildcard: 0 Address: 168 Wildcard: 0 Address: 1 Wildcard: 0 Address: 0 Wildcard: 255 Wildcard 0 in an octet: every bit must match the address above it. Wildcard 255 in an octet: no bit is checked — any value 0 to 255 matches. Result: 192.168.1.0 0.0.0.255 matches 192.168.1.0 through 192.168.1.255 — 256 addresses.

Wildcard mask vs subnet mask: the same street, opposite stencils

Subnet maskWildcard mask
JobSplits an address into network and host partsTells a check which bits to compare and which to ignore
Meaning of a 1 bitThis bit is networkDo not care about this bit
Meaning of a 0 bitThis bit is hostThis bit must match
For a /24 network255.255.255.00.0.0.255
Where you type itInterface addresses, routing tables, host settingsCisco ACLs, OSPF and EIGRP network statements
Must the 1 bits be together?Yes — a normal subnet mask is one unbroken run of 1s, then 0sIn ACLs, no — see the even-hosts example below. In OSPF statements, keep it contiguous in practice

The conversion is simple arithmetic, octet by octet: wildcard = 255 minus the subnet-mask octet. No binary is needed for the common cases. Work the three you will meet constantly:

PrefixSubnet maskSubtract each octet from 255Wildcard maskAddresses matched
/24255.255.255.00, 0, 0, 2550.0.0.255256
/26255.255.255.1920, 0, 0, 630.0.0.6364
/30255.255.255.2520, 0, 0, 30.0.0.34
/32 (one host)255.255.255.2550, 0, 0, 00.0.0.01
/0 (everything)0.0.0.0255, 255, 255, 255255.255.255.255All of IPv4

Notice the pattern in the last column: the number of addresses matched is always the wildcard's do-not-care space plus one per ignored bit — in plain terms, for a tidy contiguous mask it is 256 divided by the subnet size, and you can sanity-check any conversion with it. A /26 has 64 addresses, so its wildcard must leave exactly 64 values open: 0.0.0.63 does (0 through 63). If your arithmetic produces a wildcard whose open range does not match the subnet size, the arithmetic is wrong — stop and redo it before the line goes anywhere near a router.

Reading one ACL line bit by bit

Here is the most common ACL line in the world, taken apart slowly:

access-list 10 permit 192.168.1.0 0.0.0.255

Step 1 — split the pair. The first address, 192.168.1.0, is the pattern. The second, 0.0.0.255, is the wildcard that says which parts of the pattern count.

Step 2 — read octet by octet. Octets one to three have wildcard 0, which in binary is 00000000: no bit is ignored, so a packet's first three octets must be exactly 192, 168, and 1. The fourth octet has wildcard 255, binary 11111111: every bit is ignored, so the packet's last octet can be anything at all.

Step 3 — state the match in English. Permit any packet whose source address is in 192.168.1.0 to 192.168.1.255. If you cannot say the English sentence, you do not yet know what the line does — that sentence is the real configuration, and the numbers are just its shorthand.

Convert a /26: subtract every subnet-mask octet from 255 Subnet mask: 255 . 255 . 255 . 192 255 minus each: 0 . 0 . 0 . 63 Wildcard mask: 0 . 0 . 0 . 63 Check: a /26 holds 64 addresses, and wildcard 63 leaves exactly 0 to 63 open. If the open range and the subnet size disagree, the conversion is wrong.

Host, range, and the clever trick: three more worked examples

Exactly one host. permit host 10.1.1.5 is shorthand for permit 10.1.1.5 0.0.0.0. Wildcard all-zero means every bit must match, so only that one address qualifies. This is the line you use for a single server, a single admin workstation, a single anything.

A small range that is not a whole subnet. permit 10.0.0.8 0.0.0.7 must match the first three octets and the top five bits of the last octet (wildcard 7 is binary 00000111 — only the last three bits are ignored). The last octet can therefore vary only from 8 to 15: eight addresses, the same block a /29 starting at .8 would cover. Ranges that start on a tidy boundary work like small subnets; that tidiness is what makes them readable.

The trick subnet masks cannot do. Because an ACL wildcard does not have to be one unbroken run, permit 192.168.1.0 0.0.0.254 is legal in an ACL. Wildcard 254 is binary 11111110: only the very last bit must match, and the pattern's last bit is 0 — so this matches only the even addresses in the subnet (.0, .2, .4, and so on). It is a genuine technique for matching, say, one of a pair of alternating devices, and also a warning: a wildcard that looks like a typo may be deliberate, and a deliberate-looking one may be a typo. Read the bits before you judge the line. Do not carry this trick into OSPF network statements — there, use the normal contiguous wildcard for the subnet.

Where else you will meet wildcard masks

OSPF network statements. network 192.168.1.0 0.0.0.255 area 0 under OSPF does not advertise that subnet; it selects which interfaces, whose addresses fall inside the must-match pattern, run OSPF in area 0. The mask is read exactly as in an ACL — which is why a host statement, network 10.1.1.5 0.0.0.0 area 0, is a precise and common way to enable OSPF on one interface only.

EIGRP and ACL-based tools. EIGRP network statements use the same convention, and so do the matching fields inside route-maps and prefix filters on Cisco platforms. Learn the stencil once and you can read all of them; the tools in the Try it yourself box below will check your reading for you.

The mistakes that matter

1. Pasting the subnet mask into the ACL. This is the dangerous one. permit 192.168.1.0 255.255.255.0 looks plausible and is catastrophically wrong: wildcard 255 in the first three octets says ignore almost everything, so the line matches addresses across the whole IPv4 space whose last octet happens to fit — not your one subnet. A deny line built the same way can block far more than intended. Convert first, every time, even when you are sure.

2. Forgetting that the pattern address should start on its boundary. permit 192.168.1.7 0.0.0.255 still matches the whole .0 to .255 range, because the last octet is fully ignored — the 7 in the pattern is decoration the router disregards. Harmless here, confusing forever after. Write the first address of the block.

3. Reading the wildcard as a subnet mask out of habit. On a tired night, 0.0.0.3 reads as tiny and harmless. It matches four addresses. 0.0.3.255 reads as a /22-ish mask thing; as a wildcard it matches 1,024 addresses across four third-octet values. Slow down and translate: wildcard first, in English, then judge.

4. Assuming every platform reads it the same way. Wildcard masks in this inverted form are a Cisco IOS convention that many engineers carry in their heads as universal. Other vendors express the same idea differently — Juniper, for example, generally uses ordinary prefix lengths in firewall filters instead of wildcard masks. Check the platform's own syntax before translating a rule set.

Fact-check sourcesEvery number in this guide is worked arithmetic, verified against the conversion rule wildcard = 255 minus subnet-mask octet, per octet: /24 255.255.255.0 to 0.0.0.255 (256 addresses), /26 255.255.255.192 to 0.0.0.63 (64 addresses), /30 255.255.255.252 to 0.0.0.3 (4 addresses), host 0.0.0.0 (1 address), any 0.0.0.0 255.255.255.255 (all addresses). Binary expansions: 255 = 11111111, 254 = 11111110, 7 = 00000111, 0 = 00000000. The host and any keywords and the OSPF network-statement use follow standard Cisco IOS ACL and OSPF configuration conventions. No traffic statistics or external claims are made.

Try it yourself

Open the free ACL analyzer and paste in access-list 10 permit 192.168.1.0 0.0.0.255, then add a second line access-list 10 permit 192.168.1.7 0.0.0.255 underneath it and run the analysis: the second line is flagged as covered by the first, because the ignored last octet makes them the same rule — the boundary mistake from this guide, caught by a tool. Then open the free subnet calculator, enter 192.168.1.0/26, and check the two numbers side by side: subnet mask 255.255.255.192 on the calculator, wildcard 0.0.0.63 in your converted ACL line. When those two views agree in your head without effort, wildcard masks have stopped being backwards.

Key takeaways

Keep reading