How the subnet calculator works
The tool parses the IP address and CIDR prefix, derives the subnet mask, computes network and broadcast, and projects the valid host range. It is useful for planning, documentation, and troubleshooting.
- Input: valid IPv4 address (e.g., 192.168.1.37) and CIDR prefix (e.g., /26).
- Conversion: from prefix to dotted-decimal mask (e.g., /26 → 255.255.255.192).
- Computation: identifies network and broadcast via bitwise operations.
- Output: first/last host, total usable hosts, and IP class/direction.
CIDR, mask, and host capacity
CIDR defines how many bits belong to the network. The larger the prefix, the fewer hosts are available.
- /24 → mask
255.255.255.0→ 254 usable hosts. - /26 → mask
255.255.255.192→ 62 usable hosts. - /30 → mask
255.255.255.252→ 2 usable hosts (common on point-to-point links).
Practical examples
- Example A: IP
192.168.1.37/26. /26 blocks increment by 64:192.168.1.0–63,64–127, etc. Therefore, network192.168.1.0, broadcast192.168.1.63, hosts192.168.1.1–192.168.1.62(62 usable). - Example B: IP
10.0.5.200/20. /20 increment is 16 in the third octet: blocks10.0.0.0/20,10.0.16.0/20…10.0.5.200is in block10.0.0.0/20. Network10.0.0.0, broadcast10.0.15.255, hosts10.0.0.1–10.0.15.254(4094 usable).
VLSM: allocating from largest to smallest
With VLSM (Variable Length Subnet Mask), you split a larger block into subnets of different sizes, prioritizing larger requirements first to avoid waste.
- List the required subnets (e.g., 60, 28, 10, 2 hosts).
- Sort by size and assign blocks from the largest, respecting alignment and increments.
- Document masks, gateways, and reservations (e.g., router, VIP, and DHCP addresses).