Paste a dotted decimal subnet mask such as 255.255.240.0 and this tool returns the matching CIDR prefix length, for example /20. It counts the leading one bits in the mask and confirms that the mask is contiguous, which means every one bit sits to the left of every zero bit. That check matters because a value that looks like a mask but has gaps is not a valid subnet mask, and this tool will tell you clearly rather than returning a misleading number. This is the reverse of writing a prefix out in full, and it is handy when a config file gives you the long mask but the system you are entering it into wants the slash form. It also shows the number of host addresses the mask covers. The whole calculation runs locally in your browser, so nothing is uploaded.
It counts the leading one bits in the dotted decimal mask, so 255.255.255.0 has 24 one bits and becomes /24.
A valid subnet mask must have all its one bits contiguous at the front; the tool flags masks like 255.0.255.0 that are not contiguous.
Yes, an all ones mask converts to /32, which describes a single host address.
Paste a dotted decimal subnet mask such as 255. 255.
Yes. Netmask to CIDR Converter is completely free, with no sign-up and no usage limits.
Yes. Netmask to CIDR Converter runs in any modern web browser. There is nothing to download or install.
Yes. Netmask to CIDR Converter runs entirely on your device in your browser, so nothing you enter is uploaded to a server.