Guide ยท 8 min read

How to Calculate Subnets: A Step-by-Step Guide

Network address, broadcast address, usable host range and CIDR notation โ€” explained with two fully worked examples you can check by hand.

Why Subnetting Skills Matter

Subnetting comes up constantly in real IT work: configuring a DHCP scope, writing a firewall rule, sizing a VLAN, or working out whether two devices can actually talk to each other. A calculator can give you the answer in seconds, but understanding the math behind it means you can sanity-check the result, explain it to a colleague, and spot a misconfigured network before it causes an outage.

This guide walks through the manual process step by step, using the same logic our Subnet Calculator runs internally, so you can follow along and verify each step by hand.

IP Addresses and CIDR Notation

An IPv4 address such as 192.168.1.0 is really four 8-bit numbers (octets) written in decimal, separated by dots. Each octet ranges from 0 to 255 because that is the full range of an 8-bit binary number (00000000 to 11111111).

CIDR notation, written as /26 after an address, tells you how many of the 32 total bits are fixed as the network portion. The remaining bits belong to the host portion and identify individual devices within that network.

  • /24 = 24 network bits, 8 host bits โ†’ 256 total addresses
  • /26 = 26 network bits, 6 host bits โ†’ 64 total addresses
  • /30 = 30 network bits, 2 host bits โ†’ 4 total addresses (typically used for point-to-point links)

The number of total addresses in any subnet is always 2^(host bits). Two of those addresses in a standard subnet are reserved: the network address (all host bits set to 0) and the broadcast address (all host bits set to 1). Neither can be assigned to a device.

Worked Example: Calculating a /26 Subnet

Let's calculate everything for 192.168.1.0/26.

Step 1 โ€” Find the block size. A /26 leaves 6 host bits, so the subnet contains 2โถ = 64 addresses. The subnet mask for /26 is 255.255.255.192, because 192 in binary is 11000000 โ€” the last two bits (the network bits borrowed from the host portion) are set, leaving a block size of 256 โˆ’ 192 = 64.

Network: 192.168.1.0 Subnet mask: 255.255.255.192 Broadcast: 192.168.1.63 Usable range: 192.168.1.1 โ€“ 192.168.1.62 Usable hosts: 62 (64 total โˆ’ network โˆ’ broadcast) Wildcard mask: 0.0.0.63

You can confirm every one of these values instantly with the Subnet Calculator โ€” useful for double-checking your manual working before you apply a change.

Worked Example: Splitting a /24 Into Four Equal Subnets

A common real-world task: you have 192.168.10.0/24 and need to split it into four separate subnets โ€” for example, four floors of an office, each on its own VLAN. Splitting into four equal parts means borrowing 2 bits (since 2ยฒ = 4), turning a /24 into four /26 blocks:

192.168.10.0/26 โ†’ usable .1 โ€“ .62 (broadcast .63) 192.168.10.64/26 โ†’ usable .65 โ€“ .126 (broadcast .127) 192.168.10.128/26 โ†’ usable .129 โ€“ .190 (broadcast .191) 192.168.10.192/26 โ†’ usable .193 โ€“ .254 (broadcast .255)

Notice each block starts exactly one block size (64) after the previous one. This pattern โ€” network address, next network address = previous + block size โ€” is the fastest way to lay out subnets by hand once you know the block size.

Common Mistakes to Avoid

  • Assigning the network or broadcast address to a device. Both are reserved and will cause connectivity issues if used.
  • Confusing the subnet mask with the wildcard mask. A wildcard mask (used in Cisco ACLs) is the inverse of the subnet mask โ€” 0.0.0.63 is the wildcard for a /26, not 255.255.255.192. Our CIDR to Wildcard tool converts between the two automatically.
  • Forgetting that block size comes from 256 minus the relevant octet value in the mask, not from the CIDR number directly.
  • Using fixed equal-sized subnets when requirements differ. If one department needs 100 hosts and another needs 10, splitting everything into equal /26 blocks wastes addresses โ€” see the VLSM section below.
  • Off-by-one errors when counting usable hosts. Usable hosts = total addresses โˆ’ 2, except for /31 (point-to-point links, 2 usable addresses under RFC 3021) and /32 (a single host route).

When You Need VLSM Instead of Fixed Subnetting

Fixed-size subnetting works well when every subnet needs roughly the same number of hosts. But real networks rarely look like that โ€” a server VLAN might need 50 addresses, a guest Wi-Fi network might need 20, and a router-to-router link only needs 2. Forcing all of these into equal-sized /26 blocks wastes a large amount of address space.

Variable Length Subnet Masking (VLSM) solves this by allocating a differently-sized block to each subnet based on its actual host requirement, starting with the largest requirement first. Our VLSM Subnet Planner automates this โ€” enter your required host counts and it assigns the smallest subnet that fits each one, with no manual trial and error.

Tools For This Guide

Frequently Asked Questions

What's the difference between a subnet mask and CIDR notation?
They describe the same thing in two formats. A subnet mask (like 255.255.255.192) spells out which bits are network bits using decimal notation. CIDR notation (like /26) simply states the number of network bits. Both tell you the same block size and host count.
How many usable hosts does a /27 have?
A /27 leaves 5 host bits (32 โˆ’ 27 = 5), giving 2โต = 32 total addresses. Subtracting the network and broadcast address leaves 30 usable host addresses.
Can I use a /31 subnet?
Yes. RFC 3021 defines /31 subnets specifically for point-to-point links, where both addresses in the 2-address block are usable (no network or broadcast address is reserved). This is common on router-to-router WAN links to avoid wasting a full /30 (which only offers 2 usable addresses out of 4 anyway).
What's the fastest way to double-check my subnetting by hand?
Work out the block size first (256 minus the relevant mask octet), then list out network addresses by adding the block size repeatedly. Cross-check the result against the Subnet Calculator before applying any change to production equipment.

Verify Your Subnetting Instantly

Skip the manual math next time โ€” enter an IP and CIDR prefix and get every value instantly, right in your browser.