CIDR & Subnet Calculator
Input Parameters
Computed Results
The CIDR & Subnet Calculator determines the network boundaries and host capacity for a given IPv4 address and CIDR prefix. It calculates the total number of addresses, usable hosts, subnet mask, wildcard mask, and the specific IP range from the first to the last usable host.
How the CIDR Calculation Works
Classless Inter-Domain Routing (CIDR) notation combines an IP address with a prefix length, representing the number of bits used for the network portion of the address. The remaining bits determine the number of available host addresses.
An IPv4 address consists of 32 bits. The total number of addresses in a subnet is calculated using the formula:
In most standard subnets, the first address is reserved to identify the network itself, and the last address is reserved as the broadcast address. Therefore, the number of usable hosts is typically calculated as:
There are exceptions for specific prefix lengths. A /32 prefix represents a single host address (1 usable host), and a /31 prefix is often used for point-to-point links, providing exactly 2 usable hosts with no dedicated network or broadcast addresses.
Subnet Calculation Examples
The following examples demonstrate how different CIDR prefixes affect the size and boundaries of a network.
Small Point-to-Point Link (/30)
A /30 subnet is commonly used for router-to-router connections. Using the input 10.0.0.0/30, the calculator determines:
- Total Addresses: 4
- Usable Hosts: 2
- Subnet Mask: 255.255.255.252
- Usable Range: 10.0.0.1 to 10.0.0.2
Small Office Subnet (/28)
For a small network requiring a limited number of devices, a /28 prefix might be used. With the input 192.168.10.0/28, the results are:
- Total Addresses: 16
- Usable Hosts: 14
- Subnet Mask: 255.255.255.240
- Usable Range: 192.168.10.1 to 192.168.10.14
Medium Network Block (/16)
Larger organizational networks often use a /16 prefix. Entering 10.0.0.0/16 yields:
- Total Addresses: 65,536
- Usable Hosts: 65,534
- Subnet Mask: 255.255.0.0
- Usable Range: 10.0.0.1 to 10.0.255.254
Practical Use Cases
Understanding CIDR notation and subnet boundaries is essential for network design and management. Network administrators use these calculations to segment large IP blocks into smaller, manageable subnets, ensuring efficient use of available IP addresses. It helps in configuring routers, firewalls, and DHCP servers by providing the exact network address, broadcast address, and the range of IPs that can be assigned to devices.
Frequently Asked Questions
What is the difference between a subnet mask and a wildcard mask?
A subnet mask uses binary 1s to represent the network portion of an IP address and 0s for the host portion. A wildcard mask is the exact inverse, using 0s for the network portion and 1s for the host portion. Wildcard masks are frequently used in routing protocols and access control lists (ACLs).
Why are two addresses subtracted to find usable hosts?
In standard IPv4 subnets, the first address in the range is reserved as the network address, which identifies the subnet itself. The last address is reserved as the broadcast address, used to send data to all hosts on that subnet. These two addresses cannot be assigned to individual devices.
How does the calculator determine the IP Class?
The IP class is determined by the value of the first octet in the IPv4 address. For example, values from 1 to 126 indicate Class A, 128 to 191 indicate Class B, and 192 to 223 indicate Class C. CIDR allows for classless routing, but the traditional class designation is still identified based on this first octet.