Subnet mask calculator
Convert between subnet mask, CIDR prefix, wildcard mask and host count.
Runs 100% in your browserHow to convert subnet masks
- Enter a mask or CIDR. Type a subnet mask in dotted form or a CIDR like /24.
- Read the conversions. Mask, CIDR prefix, wildcard, host count and binary appear instantly.
CIDR ↔ mask conversion
Network gear and cloud consoles disagree about whether they want a CIDR prefix or a dotted mask in any given field, and the on-the-fly conversion is the most common reason engineers reach for a calculator. The math is straightforward — every prefix value 0–32 maps to a single contiguous mask — and a valid IPv4 mask is always a run of 1-bits followed by 0-bits (255.255.0.255 is not a legal mask). The page rejects non-contiguous masks and shows both forms plus the wildcard, host count and binary representation.
Frequently asked questions
- A 32-bit value that marks which bits of an IPv4 address are the network portion (1s) and which are the host portion (0s). 255.255.255.0 means "first 24 bits are the network."
- The prefix /N is just the number of 1-bits in the mask. /24 ↔ 255.255.255.0, /25 ↔ 255.255.255.128, /30 ↔ 255.255.255.252, etc.
- The bitwise inverse of the subnet mask. /24 has a wildcard 0.0.0.255. Used in Cisco ACLs and OSPF.
- Yes — type any valid mask like 255.255.240.0 and the page reports its prefix length, host count and wildcard.