Subnet mask calculator
Convert between a CIDR prefix and a dotted subnet mask, in either direction, and see the wildcard mask and host count for any /0 to /32.
Slide the prefix to see the matching mask.
Or type a mask to get the prefix.
Prefix and mask are two views of the same thing
A subnet mask and a CIDR prefix describe the same boundary between the network and host parts of an address. The prefix counts the network bits; the mask draws them out as a dotted-decimal number. /24 and 255.255.255.0 are interchangeable. This tool lets you start from whichever you have and get the other, along with the wildcard mask that access lists use.
Only nine values can appear in a mask octet: 0, 128, 192, 224, 240, 248, 252, 254, and 255. If you see anything else, the mask is not a standard contiguous mask. For the reasoning behind that, read what is a subnet mask, and for every prefix in one table see the CIDR cheat sheet.
Frequently asked questions
How do I convert a prefix to a subnet mask?
Count the prefix bits from the left as 1s and fill the rest with 0s. A /26 is twenty-six 1s, which reads as 255.255.255.192. This tool does the conversion instantly, both ways.
What is the subnet mask for /24?
A /24 is 255.255.255.0. It reserves the first three octets for the network, leaving 254 usable host addresses.
How do I find my subnet mask?
Run ipconfig on Windows or ip addr on Linux and macOS. The mask shows as a dotted value or a prefix. Paste either form here to convert between them.
Why is 255.255.255.100 not a valid mask?
A subnet mask must be a run of 1 bits followed by a run of 0 bits with no gaps. 100 (01100100) has 0s before its 1s, so it is not a valid contiguous mask.