What is a CIDR calculator?
A CIDR calculator is a networking utility that converts CIDR prefix lengths into IPv4 subnet masks and helps determine the size of an IP network. It can also convert a valid subnet mask back into CIDR notation.
For example, a CIDR prefix of /24 corresponds to the subnet mask 255.255.255.0. That prefix leaves 8 host bits, which provides 256 total IPv4 addresses in the subnet. In a traditional subnet, 254 of those addresses are normally available for hosts.
What does CIDR mean?
CIDR stands for Classless Inter-Domain Routing. It is a method for describing IP networks using a prefix length rather than relying on the older class-based address system.
CIDR notation is written using a slash followed by a number. An IPv4 network such as 192.168.1.0/24 uses 24 of the 32 IPv4 bits for the network portion. The remaining 8 bits represent address space inside that subnet.
How does a CIDR calculator work?
IPv4 addresses contain 32 bits. The CIDR prefix tells the calculator how many of those bits belong to the network portion. A /24 uses 24 network bits and leaves 8 host bits. A /26 uses 26 network bits and leaves 6 host bits.
The calculator converts those network bits into a dotted-decimal subnet mask. It also determines the inverse wildcard mask and uses the remaining host bits to calculate the total number of IPv4 addresses available in the subnet.
How to use the CIDR calculator
- Choose whether you want to convert CIDR to a subnet mask or a subnet mask to CIDR.
- Enter a CIDR prefix such as /24, or a subnet mask such as 255.255.255.0.
- Click Calculate CIDR.
- Review the CIDR prefix, subnet mask, wildcard mask, host bits and address capacity.
CIDR prefix and subnet mask examples
A CIDR prefix and subnet mask represent the same network boundary in different forms. CIDR is shorter and is commonly used when writing networks, while dotted-decimal subnet masks are still widely used in device configurations and documentation.
| CIDR | Subnet Mask | Host Bits | Total Addresses | Usable Hosts* |
|---|---|---|---|---|
| /16 | 255.255.0.0 | 16 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 12 | 4,096 | 4,094 |
| /24 | 255.255.255.0 | 8 | 256 | 254 |
| /25 | 255.255.255.128 | 7 | 128 | 126 |
| /26 | 255.255.255.192 | 6 | 64 | 62 |
| /27 | 255.255.255.224 | 5 | 32 | 30 |
| /28 | 255.255.255.240 | 4 | 16 | 14 |
| /29 | 255.255.255.248 | 3 | 8 | 6 |
| /30 | 255.255.255.252 | 2 | 4 | 2 |
*Traditional usable-host counts exclude the network and broadcast addresses. /31 and /32 are special cases.
What is a subnet mask?
A subnet mask is a 32-bit value that separates the network portion of an IPv4 address from the host portion. It is commonly written in dotted-decimal notation, such as 255.255.255.0.
In binary, the network portion of a valid subnet mask consists of consecutive 1 bits followed by consecutive 0 bits. For example, 255.255.255.0 contains 24 leading 1 bits, so it is equivalent to CIDR prefix /24.
What is a wildcard mask?
A wildcard mask is the inverse of a subnet mask. Wherever the subnet mask contains a binary 1, the wildcard mask contains 0, and wherever the subnet mask contains 0, the wildcard mask contains 1.
For example, the subnet mask 255.255.255.0 has the wildcard mask 0.0.0.255. Wildcard masks are often used in routing configuration and access control rules.
Why does a larger CIDR prefix create a smaller subnet?
An IPv4 address always contains 32 bits. Increasing the CIDR prefix assigns more of those bits to the network portion, leaving fewer bits available for addresses inside the subnet.
A /24 leaves 8 host bits and therefore provides 256 total addresses. A /28 leaves only 4 host bits and provides 16 total addresses. Therefore, /28 is a smaller subnet than /24.
Frequently asked questions
What CIDR is 255.255.255.0?
The subnet mask 255.255.255.0 corresponds to CIDR prefix /24.
What subnet mask is /26?
A /26 CIDR prefix corresponds to the subnet mask 255.255.255.192. It contains 64 total IPv4 addresses and traditionally provides 62 usable host addresses.
What is the difference between /24 and /16?
A /24 uses 24 network bits and provides 256 total IPv4 addresses, while a /16 uses 16 network bits and provides 65,536 total addresses. A /16 is therefore much larger.
Can every subnet mask be converted to CIDR?
A valid IPv4 subnet mask can be converted to CIDR when its binary 1 bits are contiguous. Masks with separated or non-contiguous 1 bits are not valid standard subnet masks.
How many usable hosts are in a /30?
A traditional /30 subnet contains four total IPv4 addresses and normally provides two usable host addresses.
What are /31 and /32 used for?
A /31 contains two addresses and is commonly used on point-to-point links. A /32 identifies a single IPv4 address and is often used for host routes or loopback addressing.