Wildcard Mask Calculator
Convert between subnet masks, prefix lengths and wildcard masks for ACLs and routing filters.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Prefix /24: netmask 255.255.255.0, wildcard 0.0.0.255.
How it works
- Resolved the input to a prefix length.
- Built the netmask from the prefix as an unsigned 32-bit integer.
- Inverted every bit to produce the wildcard mask.
wildcard = NOT netmask- A wildcard mask is the bitwise complement of the subnet mask.
- Only contiguous netmasks have a defined prefix length and are accepted.
Methodology
- Parse the input as a netmask/prefix or as a wildcard mask.
- Invert a wildcard to recover the netmask and confirm the netmask is contiguous.
- Derive the prefix length, netmask, wildcard and host counts from the resolved boundary.
Usage
- Choose whether the input is a netmask/prefix or a wildcard mask.
- Enter the value.
- Read the prefix, netmask and wildcard.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
A /24 netmask to wildcard
{
"kind": "netmask",
"mask": "255.255.255.0"
}A wildcard back to a prefix
{
"kind": "wildcard",
"mask": "0.0.0.255"
}A /30 from prefix notation
{
"kind": "netmask",
"mask": "/30"
}Limitations
Why routers use inverse masks
Access control lists express a match as a base address plus a wildcard mask: a 1 in the wildcard means the corresponding address bit is ignored, and a 0 means it must match. That is exactly the complement of the subnet mask.
Because wildcards are just bit patterns, they can be non-contiguous, but a non-contiguous wildcard no longer corresponds to a single subnet and has no prefix length. This tool states that boundary instead of inventing a prefix.
Frequently asked questions
- What is a wildcard mask?
- It is the bitwise inverse of a subnet mask: where the netmask has a 1 the wildcard has a 0, and vice versa.
- Can a wildcard mask be non-contiguous?
- Wildcards can be non-contiguous, but then their inverse is not a valid subnet mask and has no prefix length, so this tool rejects it.
Sources
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.