Networking GUIDE

Subnet and CIDR Calculator Guide

Understand IPv4 masks, network boundaries, host ranges, and the special cases for /31 and /32.

Updated About 4 min read
Open Subnet Calculator

Read an IPv4 network as an address plus a prefix

An IPv4 address contains 32 bits, commonly written as four decimal octets such as 192.168.1.10. Each octet ranges from 0 to 255. The address alone does not tell you which addresses share a network; that requires a subnet mask or prefix length.

CIDR notation appends the number of network bits: 192.168.1.10/24 has 24 network bits and eight remaining bits. The Subnet Calculator uses that IPv4 address and prefix to calculate the mask, network boundary, highest address, host range, and address capacity. It does arithmetic locally; it does not discover your interface settings or check network connectivity.

Understand each result

The subnet mask has one bit for every network bit. A /24 mask is 255.255.255.0. The network address is obtained by clearing the host bits; for 192.168.1.10/24, that is 192.168.1.0.

For an ordinary broadcast subnet, the broadcast address has all host bits set. In the same example it is 192.168.1.255. The conventional usable host range is then 192.168.1.1 through 192.168.1.254. These are address slots, not a guarantee of available leases. Gateways, static assignments, reservations, and infrastructure services can consume some of them.

The total number of addresses is 2^(32-prefix). For conventional subnets through /30, the calculator subtracts the network and broadcast slots to report usable hosts. /31 and /32 need different interpretations, explained below.

Calculate a subnet step by step

  1. Open the calculator and enter an IPv4 address without an appended slash.
  2. Enter the CIDR prefix in the separate field, as a whole number from 0 to 32.
  3. Select Calculate subnet.
  4. Compare the mask, network address, and first/last host values with the network design.
  5. Record the full CIDR block when documenting a route or rule, rather than copying only the example host address.

For a smaller segment, use 192.168.1.70 and prefix 26:

Subnet mask:       255.255.255.192
Network address:   192.168.1.64
Broadcast address: 192.168.1.127
First host:        192.168.1.65
Last host:         192.168.1.126
Total addresses:   64
Usable hosts:      62

Notice that a /26 does not always begin at .0. Its last-octet boundaries are .0, .64, .128, and .192. The input falls inside the second block.

Compare common prefix lengths

PrefixMaskTotal addressesHost interpretation
/24255.255.255.0256254 conventional host slots
/26255.255.255.1926462 conventional host slots
/30255.255.255.2524Two conventional host slots
/31255.255.255.2542Two endpoints on a supported point-to-point link
/32255.255.255.2551One specific address, often used in a host route

For 192.0.2.10/31, the two addresses are .10 and .11. The calculator includes both in the host range. Its generic broadcast field displays the highest address in the block, but that is not a directed broadcast destination on an RFC 3021 point-to-point link. RFC 3021 specifies the endpoint interpretation; verify support on the devices and link type you intend to use.

With /32, network, first host, last host, and highest address are all the same value. This is a one-address prefix, not a shared LAN containing a separate gateway and broadcast address.

Avoid common planning mistakes

Do not assume the first three octets always identify the network. That shortcut only fits certain prefix lengths. A /23 spans two adjacent /24 blocks, while /26 divides one /24 into four blocks. Always carry the prefix with the address when comparing membership.

Do not choose an ordinary subnet's network or broadcast address as a workstation address. Conversely, do not subtract two addresses from /31 and conclude it has no endpoints. Also distinguish capacity from connectivity: matching prefixes cannot repair a wrong VLAN, missing route, denied firewall policy, or duplicate address.

This tool handles IPv4 only and accepts the prefix rather than a dotted-decimal mask as input. It does not validate whether your organization owns or permits the address space. Use its output to check the mathematics, then verify the operational design with your network configuration and address inventory.

Try the Subnet Calculator with /24, /26, /31, and /32 to compare the boundaries before creating a network change.

Ready to try it?

Subnet Calculator

Understand IPv4 masks, network boundaries, host ranges, and the special cases for /31 and /32.

Open Subnet Calculator

Related tools

Related resources