Wildcard Masks Explained

A wildcard mask is the bitwise inverse of a subnet mask. Where a subnet mask uses 1-bits to mark the network (must match), a wildcard mask uses 0-bits to mark what must match and 1-bits to mark what to ignore. Wildcard masks appear in Cisco ACLs, OSPF network statements, EIGRP, and a few other places. Convert any prefix with the wildcard mask calculator.

Built by a network engineerCalculations run locally in your browserNo signup requiredNetwork information is not transmitted to our servers

Subnet mask vs wildcard mask

Subnet mask bitMeaningWildcard bitMeaning
1Must match (network)0Must match
0Ignore (host)1Ignore (wildcard)

The conversion is simply wildcard = 255.255.255.255 − subnet_mask, octet by octet.

Conversion examples

PrefixSubnet maskWildcard maskCalculation
/24255.255.255.00.0.0.255255−255, 255−255, 255−255, 255−0
/25255.255.255.1280.0.0.127255−128=127
/26255.255.255.1920.0.0.63255−192=63
/27255.255.255.2240.0.0.31255−224=31
/28255.255.255.2400.0.0.15255−240=15
/30255.255.255.2520.0.0.3255−252=3
/16255.255.0.00.0.255.255—
/8255.0.0.00.255.255.255—

Wildcard masks in ACLs

In a Cisco ACL, the address + wildcard pair defines which source (or destination) addresses match the line. A 0-bit in the wildcard means the corresponding address bit must match; a 1-bit means it is ignored.

! Match the entire 192.168.1.0/24 subnet
access-list 10 permit 192.168.1.0 0.0.0.255

! Match a single host (all bits must match)
access-list 10 permit 192.168.1.50 0.0.0.0
! Shorthand:
access-list 10 permit host 192.168.1.50

! Match any address (all bits ignored)
access-list 10 permit 0.0.0.0 255.255.255.255
! Shorthand:
access-list 10 permit any

Matching a range of subnets

Wildcard masks can be non-contiguous to match several subnets at once. To match 192.168.0.0/24, 192.168.1.0/24, 192.168.4.0/24, and 192.168.5.0/24 with one line, find the bits that vary and set those wildcard bits to 1:

0   = 00000000
1   = 00000001
4   = 00000100
5   = 00000101
        ^^^  ← bits that vary → wildcard 00000111 = 7

access-list 10 permit 192.168.0.0 0.0.7.255

This matches 192.168.0.0 through 192.168.7.255 — broader than the four you wanted. For a precise match, use multiple lines or a prefix-list instead.

Wildcard masks in OSPF

OSPF network statements use wildcard masks to decide which interfaces join an area. The statement matches any interface whose IP address falls within the address + wildcard range.

router ospf 1
 ! Match interfaces in 10.0.0.0/24
 network 10.0.0.0 0.0.0.255 area 0
 ! Match a single interface
 network 10.0.0.1 0.0.0.0 area 0
 ! Match all 10.x.x.x interfaces
 network 10.0.0.0 0.255.255.255 area 0

A common practice is to use 0.0.0.0 wildcards (exact match) for loopbacks to avoid accidentally matching more than intended.

The "any" and "host" keywords

KeywordEquivalentMeaning
any0.0.0.0 255.255.255.255Match every address
host A.B.C.DA.B.C.D 0.0.0.0Match exactly one address

Common mistakes

  • Using a subnet mask in an ACL — Cisco IOS will often accept it but match the wrong range. Always convert.
  • Non-contiguous wildcards — allowed and sometimes useful, but easy to get wrong. Prefer prefix-lists for clarity.
  • Forgetting the inverse — /24 wildcard is 0.0.0.255, not 255.255.255.0.

Related guides

Technically Reviewed By

Senior Enterprise Network Engineer — 25+ years of IT and network infrastructure experience, including enterprise Cisco switching, routing, wireless, firewalls, VPN, network access control, SD-WAN, and large-scale network operations.

Last reviewed: 2026-09-02

Calculations are performed using standards-based formulas and verified against known reference values. All computation runs client-side in your browser.