CIDR Calculator

Convert between CIDR notation, subnet mask, wildcard mask, and calculate the number of available IP addresses in a subnet block.

CIDR BLOCK
--
Subnet Mask
--
Wildcard Mask
--
Total Addresses
--
Address Range
--

What Is CIDR?

CIDR (Classless Inter-Domain Routing) is a method for allocating IP addresses and routing Internet Protocol packets. Introduced in 1993 to replace the classful network architecture, CIDR allows for more flexible allocation of IP address space. The CIDR notation appends a prefix length to an IP address, written as a slash followed by a number (e.g., 192.168.1.0/24).

The prefix length indicates how many leading bits of the IP address represent the network portion. The remaining bits identify individual hosts within that network. For example, /24 means the first 24 bits are the network part, leaving 8 bits (256 addresses) for hosts.

CIDR Calculations

Total Addresses = 2^(32 - prefix length)
Usable Hosts = 2^(32 - prefix length) - 2
Subnet Mask: Set first N bits to 1, rest to 0
Wildcard Mask = NOT(Subnet Mask) = 255.255.255.255 - Subnet Mask

CIDR Reference Table

CIDRSubnet MaskWildcardAddressesClass
/8255.0.0.00.255.255.25516,777,216A
/12255.240.0.00.15.255.2551,048,576-
/16255.255.0.00.0.255.25565,536B
/20255.255.240.00.0.15.2554,096-
/24255.255.255.00.0.0.255256C
/27255.255.255.2240.0.0.3132-
/30255.255.255.2520.0.0.34-
/32255.255.255.2550.0.0.01Host

Frequently Asked Questions

What is the difference between CIDR and subnet mask?

They represent the same information in different formats. CIDR notation /24 is equivalent to subnet mask 255.255.255.0. CIDR is more compact and is the modern standard. Subnet masks are the dotted-decimal representation used in older configurations and some operating systems.

What is a wildcard mask?

A wildcard mask is the inverse of a subnet mask, calculated as 255.255.255.255 minus the subnet mask. It is commonly used in Cisco ACLs (Access Control Lists) and OSPF configurations. Where a subnet mask uses 1-bits for the network portion, a wildcard mask uses 0-bits for matching and 1-bits for "don't care" positions.

How do I choose the right CIDR block size?

Count the number of devices that need IP addresses, add room for growth (typically 2x current needs), then select the smallest CIDR block that accommodates that number. Remember to subtract 2 for network and broadcast addresses. For example, 50 devices need at least a /26 (62 usable hosts).