Skip to main content
IP Range CalculatorPRO
Masks, Wildcards & ACLInstant Client-Side Tool

Wildcard Mask to Subnet Mask Converter

Convert compatible contiguous wildcard masks.

Wildcard Mask to Subnet Mask Converter: inputs and results

Enter an IP address, CIDR prefix, or range. Then check its first and last address below.

Quick presets:

Calculated Boundaries & ParametersReady

Network Address192.168.1.0
Broadcast Address192.168.1.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
Total Addresses256
Usable Host Range254

How Wildcard Mask to Subnet Mask Converter Works?

This tool works by checking that the wildcard is contiguous, then subtracting each wildcard octet from 255 to produce the subnet mask.

  1. Enter a wildcard

    Type a wildcard such as 0.0.3.255.

  2. Check compatibility

    A wildcard converts to a subnet mask only when its 1 bits form one run on the right. 0.0.255.0 fails this check.

  3. Subtract from 255

    255 − 0, 255 − 0, 255 − 3, 255 − 255 → 255.255.252.0.

  4. Return the mask and prefix

    The converter shows 255.255.252.0 and /22.

Wildcard Mask to Subnet Mask Converter Formula

The formula is Subnet Mask = 255.255.255.255 − Wildcard, valid only when (W AND (W + 1)) = 0.

Conversion

M_i = 255 − W_i

Per octet.

Compatibility test

(W AND (W + 1)) = 0

W as a 32-bit integer.

Prefix length

p = 32 − log2(W + 1)

For 0.0.3.255: W + 1 = 1,024 → p = 22.

Worked example: 0.0.3.255

W = 1,023 → W + 1 = 1,024 = 2^10
1,023 AND 1,024 = 0 → contiguous ✓
Mask = 255.255.252.0
Prefix = 32 − 10 = /22

Wildcard Mask to Subnet Mask Converter Conversion Table

The table converts 12 wildcard masks, including 3 non-contiguous wildcards that have no subnet mask equivalent.

WildcardContiguousSubnet MaskCIDR
0.0.0.0Yes255.255.255.255/32
0.0.0.3Yes255.255.255.252/30
0.0.0.31Yes255.255.255.224/27
0.0.0.255Yes255.255.255.0/24
0.0.3.255Yes255.255.252.0/22
0.0.15.255Yes255.255.240.0/20
0.0.255.255Yes255.255.0.0/16
0.255.255.255Yes255.0.0.0/8
0.0.255.0NoNo equivalent—
0.0.254.255NoNo equivalent—
0.0.0.254NoNo equivalent—
255.255.255.255Yes0.0.0.0/0

What is Wildcard Mask to Subnet Mask Converter?

The Wildcard Mask to Subnet Mask Converter is a tool that turns a contiguous ACL or OSPF wildcard mask back into a subnet mask and prefix length.

Wildcards are more flexible than subnet masks. A wildcard such as 0.0.254.255 matches every even third octet, a pattern that no single subnet mask expresses. The converter separates compatible wildcards from non-contiguous ones.

Non-contiguous wildcards still describe valid address sets. The ACL Wildcard to CIDR Converter expands them into a list of CIDR blocks.

What are the uses of Wildcard Mask to Subnet Mask Converter?

There are 4 main uses of the Wildcard Mask to Subnet Mask Converter, including ACL review, migration, and documentation.

  • Reviewing Cisco ACLs

    Reviewers read 0.0.7.255 as /21 to confirm the subnet each line covers.

  • Migrating ACLs to other vendors

    Platforms that use prefixes need the subnet mask form of each wildcard.

  • Documenting OSPF areas

    Area documentation lists networks in CIDR form, converted from network statements.

  • Spotting unusual wildcards

    Non-contiguous wildcards stand out and get a separate review.