Home / Articles / How to Calculate IPv4 Subnets

How to Calculate IPv4 Subnets

Published:

A subnet calculation answers which addresses belong to a network. It does not tell you whether those addresses are available in your environment. Start with an address and prefix, calculate the boundaries, then compare the result with your routing and address allocation records.

Translate the prefix into a block size

IPv4 has 32 address bits. A /26 prefix leaves 6 host bits, so the block contains 2^6 = 64 addresses. Its subnet mask is 255.255.255.192. The prefix length describes how many leading bits identify the network; see RFC 4632 for CIDR notation and aggregation.

For 192.168.10.77/26, the last-octet block boundaries are 0, 64, 128 and 192. Since 77 is between 64 and 127, it belongs to the second block.

Input address:      192.168.10.77/26
Network:            192.168.10.64
Subnet mask:        255.255.255.192
Wildcard mask:      0.0.0.63
Broadcast:          192.168.10.127
Usable host range:  192.168.10.65 - 192.168.10.126
Total addresses:    64
Conventional hosts: 62

Check the calculation in FATOPS

  1. Open the IPv4 subnet calculator.
  2. Enter 192.168.10.77 in IPv4 address and choose /26 in CIDR prefix.
  3. Select Calculate subnet and compare the network and broadcast with the worked example.
  4. Change the prefix to /24 and calculate again. The larger network now spans 192.168.10.0 through 192.168.10.255.

The address field and prefix selector are separate controls; do not paste the slash and prefix into the address field. An address inside a block need not equal the network address. For a route or firewall network entry, use the normalized network and prefix, such as 192.168.10.64/26.

Do not subtract two for every prefix

A conventional broadcast subnet reserves the all-zero and all-one host portions for network and broadcast addresses. A /31 on a point-to-point link uses both addresses as endpoints under RFC 3021. A /32 identifies one address. Apply those exceptions deliberately; a cloud network may impose additional address reservations.

Distinguish a subnet from an arbitrary range

A request for addresses 192.168.10.70 through 192.168.10.90 does not describe a single aligned CIDR block. Use the IPv4 range converter with separate first and last addresses to obtain the minimal covering blocks without including extra addresses.

Before applying a result, check overlap with existing routes, VPN pools and container networks. The tool handles IPv4 arithmetic locally; it does not discover occupied addresses, test reachability or validate provider-specific reservation rules.

Tools used in this guide

Related technical guides