How to calculate an IPv4 subnet and CIDR prefix
A /24 is only the beginning. Calculate network, broadcast and host ranges for smaller subnets used by VLANs, VPNs and firewalls.
CIDR expresses how many address bits belong to the network portion. /24 equals 255.255.255.0, but segmentation, VPN and firewall rules commonly use /27, /28, /30 and larger networks.
Four values to calculate
For an address and prefix, determine the network, broadcast, first and last typical host, and total address count. These values feed DHCP, routing and access-control rules.
- The network address identifies the subnet.
- Broadcast is the final address in a traditional IPv4 subnet.
- The usual host range lies between them.
- Total addresses equal 2^(32-prefix).
Example: 192.168.10.77/27
A /27 creates blocks of 32 addresses. Address 77 is inside 64–95, so the network is 192.168.10.64, broadcast is 192.168.10.95 and the usual host range is 192.168.10.65–94.
Common mistakes
Most errors come from confusing a host with a network address or configuring different prefixes on a gateway and endpoint.
- Do not assume every private network is a /24.
- Check overlap before adding a route or VPN.
- Document the prefix with the address, for example 10.20.8.0/23.
Before deploying a subnet
- Calculate network, broadcast and host range.
- Check overlap with sites and VPNs.
- Reserve infrastructure and DHCP ranges.
- Update routing, firewall and documentation.
Put it into practice
Calculate a subnet with N3X
Enter an address and prefix to get the network, broadcast, range and host count.
Calculate a subnet with N3XFrequently asked questions
How many hosts fit in a /24?
It contains 256 addresses. A traditional IPv4 subnet offers 254 host addresses after reserving network and broadcast.
Which mask equals /27?
255.255.255.224. Successive subnets begin every 32 addresses.
Can overlapping networks communicate through a VPN?
They create routing ambiguity. Address translation can sometimes work around it, but unique ranges are preferable.
