PACKETRY BETA
All tools Wildcard Mask Calculator

Wildcard Mask Calculator

Enter a prefix length, CIDR block, or subnet mask to calculate the wildcard mask.

Quick reference table

Common prefix lengths with their subnet and wildcard masks.

PrefixSubnet maskWildcard maskUsable hosts
/8255.0.0.00.255.255.25516,777,214
/16255.255.0.00.0.255.25565,534
/20255.255.240.00.0.15.2554,094
/21255.255.248.00.0.7.2552,046
/22255.255.252.00.0.3.2551,022
/23255.255.254.00.0.1.255510
/24255.255.255.00.0.0.255254
/25255.255.255.1280.0.0.127126
/26255.255.255.1920.0.0.6362
/27255.255.255.2240.0.0.3130
/28255.255.255.2400.0.0.1514
/29255.255.255.2480.0.0.76
/30255.255.255.2520.0.0.32
/31255.255.255.2540.0.0.12
/32255.255.255.2550.0.0.01

How it works

Enter a prefix length (/24), a full CIDR block (192.168.1.0/24), or a dotted-decimal subnet mask (255.255.255.0). The two input fields are linked — changing one automatically updates the other.

A wildcard mask is the bitwise complement of a subnet mask. Each octet of the wildcard mask equals 255 − (subnet mask octet). For /24 the subnet mask is 255.255.255.0, so the wildcard is 0.0.0.255.

In a wildcard mask, a 0 bit means “this bit must match” and a 1 bit means “don't care.” This is the opposite of a subnet mask, where 1 marks the fixed network bits.

Wildcard masks appear in Cisco IOS ACLs and OSPF network statements:

access-list 10 permit 192.168.1.0 0.0.0.255
network 10.0.0.0 0.255.255.255 area 0

Most modern firewalls and Juniper JunOS use standard subnet masks instead of wildcard masks. EIGRP network statements also accept wildcard masks. Non-contiguous wildcard masks (e.g. 0.0.0.254 to match only even addresses) are supported by some platforms but are uncommon and are not generated by this calculator.

FAQ

What is a wildcard mask?

A wildcard mask is the inverse (bitwise NOT) of a subnet mask. Where a subnet mask uses 1s to indicate network bits, a wildcard mask uses 1s to indicate "don't care" bits. For example, the wildcard mask for /24 (255.255.255.0) is 0.0.0.255.

Where are wildcard masks used?

Wildcard masks are primarily used in Cisco IOS access control lists (ACLs) and OSPF network statements. They define which bits of an IP address must match (0) and which are ignored (1). Some platforms like Juniper use standard subnet masks instead.

How do I convert a subnet mask to a wildcard mask?

Subtract each octet of the subnet mask from 255. For example, 255.255.255.0 becomes 0.0.0.255 (255−255=0, 255−255=0, 255−255=0, 255−0=255). Alternatively, perform a bitwise NOT on the subnet mask.

What is the wildcard mask for a /24 network?

The wildcard mask for /24 is 0.0.0.255. The subnet mask is 255.255.255.0, and inverting it gives 0.0.0.255. This means the first 24 bits must match and the last 8 bits are ignored.