Calculate subnet masks and wildcard masks
A subnet mask defines the network/host boundary. Learn to convert between prefix length, dotted-decimal mask, and wildcard mask.
- 1
A subnet mask has 1-bits for the network portion and 0-bits for hosts. /24 → 255.255.255.0 → 11111111.11111111.11111111.00000000. The wildcard mask is the inverse: 0.0.0.255. Masks must be contiguous (all 1s followed by all 0s) — non-contiguous masks (e.g., 255.0.255.0) are invalid in modern networks.
- 2 IP Address Info →
Enter an IP/prefix to see the subnet mask and wildcard mask. The subnet mask is used for network calculations; the wildcard mask is used in ACLs (Cisco) and some firewall rules. Both represent the same network/host boundary.
- 3 Binary Encoder →
Convert a subnet mask to binary to verify it is contiguous. 255.255.240.0 → 11111111.11111111.11110000.00000000 — the 1s and 0s are contiguous, so it is valid. 255.0.255.0 → 11111111.00000000.11111111.00000000 — non-contiguous, invalid.
Frequently asked questions
- What is a wildcard mask?
- It is the bitwise NOT of the subnet mask: 255.255.255.0 → 0.0.0.255. Used in Cisco ACLs: access-list 1 permit 192.168.1.0 0.0.0.255 means "permit 192.168.1.0/24". The wildcard mask specifies which bits to ignore (0 = match, 1 = ignore) — the opposite of a subnet mask.
- Are non-contiguous masks valid?
- In theory, but in practice they are not supported by most modern routing protocols and hardware. CIDR requires contiguous masks. Non-contiguous masks were used in old BSD netmasks and some ACL configurations, but should be avoided.
Workflows that solve this
Learn more
Want to understand why?