Understanding IP Subnets
Subnetting divides an address space into predictable networks. This calculator translates CIDR notation, subnet masks, wildcard masks, and planning requirements into network address, broadcast address, usable host range, address counts, and split subnet tables.
What is CIDR?
CIDR notation writes a network as IP/prefix, such as 192.168.1.10/24 for IPv4 or 2001:db8::/48 for IPv6. The prefix length tells you how many bits belong to the network portion. A larger prefix (like /28) means a smaller subnet with fewer available addresses, while a smaller prefix (like /16) means a larger subnet.
IPv4 vs IPv6 at a glance
- IPv4: 32-bit addresses like 203.0.113.25. Includes a broadcast address and a count of usable hosts. IPv4 space is limited, so subnetting and NAT are common.
- IPv6: 128-bit addresses like 2001:db8::1. No broadcast (uses multicast), and the address space is enormous, making hierarchical planning easier.
Formulas
- IPv4 total addresses = 2^(32 - prefix).
- Usual IPv4 usable hosts = 2^(32 - prefix) - 2.
- IPv6 total addresses = 2^(128 - prefix).
- Wildcard mask = inverse subnet mask.
- Network address = IP bitwise AND subnet mask.
Worked /26 example
For 192.168.1.77/26, the subnet mask is 255.255.255.192. The block size is 64, so the /26 blocks in the last octet start at 0, 64, 128, and 192. Address 77 falls in the 192.168.1.64/26 block, broadcast is 192.168.1.127, and the usual usable range is 192.168.1.65 to 192.168.1.126.
How usable hosts are calculated (IPv4)
In IPv4, most subnets reserve the first address as the network address and the last as the broadcast address. That is why usable hosts are usually total - 2. Two special cases are common in real deployments and appear in results:
- /31: point-to-point, both addresses usable.
- /32: single host.
How to use this calculator
- Enter an IPv4 or IPv6 address and its prefix length.
- Choose the appropriate version if prompted.
- Review the calculated network, broadcast (IPv4), and usable range.
- Use the total hosts and mask to size your subnet.
- Adjust the prefix to compare larger or smaller networks.
Choosing a prefix length
- Smaller number (e.g., /16) → larger network, useful for many devices or growth.
- Larger number (e.g., /28) → smaller network, good for tight segmentation.
- IPv6 best practice: LANs use /64; sites often receive /48 or /56 for clean hierarchy.
