๐Ÿฆ IP Animals
๐Ÿงฎ Subnetting & IP Math

Subnet Mask Converter

Convert between a dotted-decimal subnet mask, a CIDR prefix length and a wildcard mask. Enter any one representation and get the other two instantly โ€” computed privately in your browser.

Convert masks, prefixes and wildcards

Network gear describes the same boundary in three different ways: a dotted-decimal subnet mask like 255.255.255.0, a CIDR prefix length like /24, and a wildcard mask like 0.0.0.255. This subnet mask converter lets you type any one of them and fills in the other two, plus the number of hosts the prefix allows.

How to use it

  • Type a dotted mask, a prefix number, or a wildcard mask into its field.
  • The other two fields update as you type, and the summary shows the binary mask and host count.
  • Copy any value with its button. All three views stay in sync automatically.

The three views explained

A subnet mask is 32 bits with the network bits set to 1 and the host bits set to 0. The prefix length is just a count of those leading 1-bits. The wildcard mask is the bit-for-bit inverse โ€” it swaps every 1 for a 0 and vice-versa โ€” and is what Cisco access lists and OSPF use. For a deeper dive, read what is a subnet mask and what is an IP address.

Tip

A valid mask must be contiguous: all the 1-bits are on the left with no gaps. That is why 255.255.255.0 is fine but 255.0.255.0 is not. If you paste a broken mask, the converter tells you rather than guessing a prefix.

Need more than the mask? The IPv4 Subnet Calculator gives the network, broadcast and full host range, and the CIDR to IP Range converter expands a block into its first and last address.

Frequently asked questions

How do I convert a subnet mask to CIDR?

Enter a dotted mask such as 255.255.255.0 and the converter counts the leading one-bits to give the prefix โ€” /24 in this case โ€” along with the matching wildcard mask and host count. You can also start from the prefix or the wildcard instead.

What is a wildcard mask?

A wildcard mask is the bitwise inverse of a subnet mask, so 255.255.255.0 becomes 0.0.0.255. It is used in Cisco access lists and OSPF, where a 0 bit means "must match" and a 1 bit means "don't care".

Why does my mask show an error?

A valid subnet mask must be contiguous: all the one-bits come first, then all the zero-bits. Values like 255.255.0.255 are not contiguous, so the converter flags them instead of producing a misleading prefix.

Does the converter run online or in my browser?

Entirely in your browser. The conversion is JavaScript that runs locally, so nothing you type is sent anywhere.

Want the theory? Read the guides โ†’ ยท Visit the zoo โ†’