IP Range and Subnet Calculator
Input Parameters
Computed Results
The IP range calculator determines the usable host addresses, network address, and broadcast address for a given IPv4 subnet. It helps network administrators and IT professionals quickly identify subnet masks, wildcard masks, and total host capacity based on an IP address and its CIDR prefix.
Practical Use Cases
Calculating exact IP ranges and subnet boundaries is a fundamental part of network administration. Common applications include:
- Network Provisioning: Sizing subnets to ensure adequate host capacity for current devices and future expansion without wasting address space.
- Device Configuration: Setting up routers, firewalls, and DHCP scopes with the correct network and broadcast addresses to ensure proper routing.
- Troubleshooting: Verifying whether two IP addresses fall within the same subnet or identifying overlapping address spaces during network mergers.
Subnet Calculation Formulas
Subnetting divides a 32-bit IPv4 address into a network portion and a host portion. The CIDR (Classless Inter-Domain Routing) prefix indicates how many bits are assigned to the network. The remaining bits determine the host capacity.
To find the total number of addresses in a subnet, subtract the CIDR prefix from 32 and raise 2 to that power:
In standard subnets, the first address is reserved for the network identifier, and the last address is reserved for the broadcast address. Therefore, the number of usable hosts is typically two less than the total addresses:
Note: Exceptions exist for /31 subnets (used for point-to-point links, providing exactly 2 usable hosts) and /32 subnets (representing a single host address).
Verified Subnet Scenarios
Here are examples of how different CIDR prefixes affect the usable IP range and host capacity:
Standard Class C Home Network
A typical local network uses a /24 subnet. If the IP address is 192.168.1.50 with a /24 CIDR, the network address is 192.168.1.0/24. The usable IP range spans from 192.168.1.1 to 192.168.1.254, providing 254 usable hosts out of 256 total addresses. This falls under Class C (Private).
Small Office Subnet
For a smaller segmented network, a /28 subnet might be used. Given the IP 172.20.10.5 with a /28 CIDR, the network address is 172.20.10.0/28. The usable range is 172.20.10.1 to 172.20.10.14, yielding 14 usable hosts. The broadcast address is 172.20.10.15, and the subnet mask is 255.255.255.240.
Point-to-Point Link Boundary Case
Router-to-router connections often use a /31 subnet to conserve IP addresses. If the IP is 172.16.5.1 with a /31 CIDR, the network address is 172.16.5.0/31. The usable IP range is exactly 172.16.5.0 to 172.16.5.1, providing 2 usable hosts and 2 total addresses, with a subnet mask of 255.255.255.254.
Frequently Asked Questions
Why are there two fewer usable hosts than total addresses in most subnets?
In standard IPv4 subnetting, the first address in the range is reserved as the network address to identify the subnet itself, and the last address is reserved as the broadcast address to send messages to all hosts on that subnet. These cannot be assigned to individual devices.
What is a wildcard mask?
A wildcard mask is the inverse of a subnet mask. It is commonly used in routing protocols (like OSPF) and access control lists (ACLs) to specify which parts of an IP address must match a rule and which parts can be ignored.
How does a /31 subnet work if it only has two addresses?
A /31 subnet is a special case defined by RFC 3021 for point-to-point links. Because there are only two devices on the link, the standard network and broadcast addresses are not required, allowing both available IP addresses to be assigned to the connected router interfaces.