Home/Network/Netmask to CIDR Converter

Netmask to CIDR Converter

/20CIDR prefix

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.

How to use Netmask to CIDR Converter

  1. Paste a dotted decimal subnet mask.
  2. Read the matching CIDR prefix length.
  3. Copy the prefix.

Frequently asked questions

How does it find the prefix length?

It counts the leading one bits in the dotted decimal mask, so 255.255.255.0 has 24 one bits and becomes /24.

Why does it validate the mask?

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.

Does 255.255.255.255 convert?

Yes, an all ones mask converts to /32, which describes a single host address.

What is Netmask to CIDR Converter?

Paste a dotted decimal subnet mask such as 255. 255.

Is Netmask to CIDR Converter free to use?

Yes. Netmask to CIDR Converter is completely free, with no sign-up and no usage limits.

Does Netmask to CIDR Converter work in a web browser?

Yes. Netmask to CIDR Converter runs in any modern web browser. There is nothing to download or install.

Is my data private with Netmask to CIDR Converter?

Yes. Netmask to CIDR Converter runs entirely on your device in your browser, so nothing you enter is uploaded to a server.