IP & Domain Tools

Subnet Mask to CIDR Prefix Calculator

Enter a subnet mask to get the CIDR prefix, wildcard mask and usable hosts.

Your numbers

Your results

CIDR prefix
CIDR prefix
—
Wildcard mask
—
Addresses per subnet
—
Usable hosts
—
Equivalent /24 networks
—

Subnet Mask to CIDR Prefix Calculator by TheCalcTools

How the Subnet Mask to CIDR Prefix Calculator works

Enter the four octets of the subnet mask.

A valid mask is a run of 1 bits followed by a run of 0 bits. The number of 1 bits is the prefix length.

The wildcard mask is the inverse of the mask, used in Cisco and Juniper ACLs.

The formula

Prefix = 32 − log₂(256⁴ − mask)Addresses = 2^(32 − prefix)

Worked example

Using the default values shown in the calculator:

Octet 1255
Octet 2255
Octet 3255
Octet 4192
  1. 255.255.255.192 has 26 one-bits, so the prefix is /26.
  2. The block holds 64 addresses, 62 usable. The wildcard is 0.0.0.63.

Result:

CIDR prefix/26
Wildcard mask0.0.0.63
Addresses per subnet64
Usable hosts62
Equivalent /24 networks0.2500

Frequently asked questions

What is 255.255.255.0 in CIDR?

/24, which gives 256 addresses and 254 usable hosts.

Why is 255.0.255.0 rejected?

A valid mask cannot have a 1 bit after a 0 bit.

Sources and further reading

More in IP & Domain Tools · All calculators

This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.