IPv4 Subnet Calculator
Calculate network boundaries, usable host ranges, and broadcast addresses for IPv4 CIDR blocks.
About Subnetting and CIDR
CIDR (Classless Inter-Domain Routing) is a method used to allocate IP addresses and route IPv4 packets. Before CIDR, networks were strictly divided into Class A, B, and C sizes, which was highly inefficient.
CIDR allows variable-length subnet masks (VLSM). A CIDR block is written as an IP address followed by a slash and a routing prefix number (e.g., 192.168.1.0/24). The number /24 indicates that the first 24 bits of the IP address denote the network, leaving the remaining 8 bits to identify specific hosts within that network.
- Network Address: The very first IP in the block, used to identify the network itself. Cannot be assigned to a host.
- Broadcast Address: The last IP in the block, used to send data to all hosts simultaneously. Cannot be assigned to a host.
- Usable Range: All addresses falling strictly between the Network and Broadcast addresses.
Our Subnet Calculator takes any IP address and prefix length and returns the network address, broadcast address, usable host range, subnet mask and total host count. It removes the binary arithmetic from network planning and firewall rule writing.
What is Subnetting?
CIDR notation writes this as an address followed by a slash and the prefix length, such as 192.168.1.0/24. The /24 means the first 24 bits identify the network, leaving 8 bits for hosts, which gives 256 addresses of which 254 are usable.
Two addresses in each IPv4 subnet are reserved. The first is the network address identifying the subnet itself, and the last is the broadcast address reaching every host on it. Neither can be assigned to a device, which is why a /24 provides 254 usable addresses rather than 256.
- Divides an address range into smaller networks
- CIDR notation gives the prefix length after a slash
- A shorter prefix means a larger network
- The first and last addresses are reserved in IPv4
- IPv6 subnetting follows the same logic without the reserved addresses
Why Subnet Calculation Matters
The arithmetic is also error-prone at the boundaries people work with least. The difference between a /22 and a /23 is easy to state and easy to get wrong under pressure, and overlapping subnets discovered after deployment are expensive to renumber.
- Firewall rules written for the wrong prefix silently over-permit
- Overlapping subnets are painful to fix after deployment
- Correct sizing prevents both address exhaustion and waste
- Cloud VPC design depends entirely on getting CIDR blocks right
- Prefix arithmetic is easy to get wrong and rarely validated
How This Subnet Calculator Works
- Validates the address and prefix length inputs
- Applies the prefix mask to determine the network address
- Calculates the broadcast address at the top of the range
- Derives the usable host range between those boundaries
- Reports the subnet mask, wildcard mask and total host count
How to Use the Subnet Calculator
- Enter an IP address with its prefix, such as 192.168.1.10/24
- Run the calculation to derive the subnet boundaries
- Review the network and broadcast addresses
- Note the usable host range for device assignment
- Use the subnet mask or wildcard mask in your device configuration
Understanding Your Subnet Results
The calculation returns every value you need for configuration:
| Field / Value | Meaning |
|---|---|
Network address |
The first address in the range, identifying the subnet itself. It cannot be assigned to a host and is what appears in routing tables. |
Broadcast address |
The last address in the range, reaching every host on the subnet. Also unassignable. IPv6 has no broadcast address, using multicast instead. |
Usable range |
The addresses between network and broadcast that can be assigned to devices. For a /24 this is 254 addresses. |
Subnet mask |
The dotted-decimal form of the prefix, such as 255.255.255.0 for a /24. Older equipment and many interfaces expect this rather than CIDR notation. |
Wildcard mask |
The inverse of the subnet mask, such as 0.0.0.255. Used in Cisco access control lists and some routing protocol configurations. |
Total hosts |
Two raised to the number of host bits, minus the two reserved addresses in IPv4. A /24 gives 254, a /25 gives 126, a /30 gives 2. |
Prefix length |
How many bits identify the network. A smaller number means a larger subnet — a /16 contains 256 times as many addresses as a /24. |
Common Problems & How to Fix Them
Best Practices
- Calculate the range before writing any firewall or routing rule
- Maintain a documented address plan to prevent overlaps
- Size subnets with headroom, since growing them later means renumbering
- Use /64 for IPv6 subnets regardless of host count
- Check on-premises and cloud ranges do not overlap before connecting them
- Use private ranges from RFC 1918 for internal networks
- Record the purpose of each allocated subnet alongside its range
Security Recommendations
- Verify firewall rule prefixes carefully, since an over-broad rule permits traffic silently with no error
- Segment networks by function so a compromise in one segment does not reach others
- Avoid excessively large flat subnets, which give an attacker a wide reachable range after initial access
- Use the calculated range when writing allowlists rather than approximating
- Document which subnet each service lives in to support incident response
- Apply the same segmentation discipline to IPv6, where the vast address space encourages flat designs