Learn how CIDR prefixes, subnet masks, network boundaries and usable host ranges work — with step-by-step examples you can apply to VLANs, site networks and cloud planning.
Subnetting is the process of dividing an IP address block into smaller, non-overlapping networks. It helps organize routing, segment VLANs, plan address capacity and make operational boundaries easier to manage. The calculations are predictable once you understand the prefix.
An IPv4 address contains 32 binary digits.
24 network bits, 8 remaining address bits.
Typically usable addresses in a conventional /24 subnet.
1. What do CIDR and subnet masks mean?
CIDR stands for Classless Inter-Domain Routing. The slash notation identifies how many of the 32 IPv4 bits are in the network prefix. For example, 192.168.10.0/26 has a 26-bit prefix and six remaining bits, giving 64 total addresses.
The dotted-decimal subnet mask represents the same prefix. A /26 mask is 255.255.255.192, while a /24 mask is 255.255.255.0. Modern routing uses explicit prefixes rather than assuming a default mask from an old address class.
The second formula applies to a typical network-and-broadcast subnet with prefix lengths /1 through /30. Special /31 and /32 use cases are explained below; provider-specific reservations may further reduce assignable addresses.
2. Quick CIDR reference table
The table shows the mask, total number of IPv4 addresses and typical usable host addresses for familiar prefix lengths.
| Prefix | Subnet mask | Total addresses | Typical usable |
|---|---|---|---|
| /23 | 255.255.254.0 | 512 | 510 |
| /24 | 255.255.255.0 | 256 | 254 |
| /25 | 255.255.255.128 | 128 | 126 |
| /26 | 255.255.255.192 | 64 | 62 |
| /27 | 255.255.255.224 | 32 | 30 |
| /28 | 255.255.255.240 | 16 | 14 |
| /29 | 255.255.255.248 | 8 | 6 |
| /30 | 255.255.255.252 | 4 | 2 |
| /31 | 255.255.255.254 | 2 | 2 endpoints on supported point-to-point links |
| /32 | 255.255.255.255 | 1 | 1 individual address / host route |
Scroll inside the table on narrow screens. /31 follows RFC 3021, and /32 is a single-address prefix rather than a conventional LAN subnet.
3. Worked example: 10.20.30.77/26
Suppose a device is assigned 10.20.30.77/26. What are its network address, broadcast address and host range?
- Find the subnet mask:
/26corresponds to255.255.255.192. - Find the address increment: In the last octet,
256 − 192 = 64. Boundaries occur at 0, 64, 128 and 192. - Locate the device: The final octet 77 lies between 64 and 127, so the network begins at
10.20.30.64. - Identify the conventional host range: The first address is the network identifier and the final address is broadcast. Hosts therefore run from .65 to .126.
4. Split one /24 into four /26 subnets
Consider an organization with 192.168.10.0/24. Borrowing two host bits changes the prefix to /26, yielding four equal subnets with 64 addresses each. Each conventional /26 accommodates up to 62 usable host addresses.
| Subnet | Network | Usable host range | Broadcast |
|---|---|---|---|
| 1 | 192.168.10.0/26 | 192.168.10.1–62 | 192.168.10.63 |
| 2 | 192.168.10.64/26 | 192.168.10.65–126 | 192.168.10.127 |
| 3 | 192.168.10.128/26 | 192.168.10.129–190 | 192.168.10.191 |
| 4 | 192.168.10.192/26 | 192.168.10.193–254 | 192.168.10.255 |
In the usable-range column, the final octet is abbreviated only after the first full address; for instance, 192.168.10.1–62 means 192.168.10.1 through 192.168.10.62.
5. /30, /31 and /32: important differences
/30 — two conventional usable hosts
A 192.168.10.0/30 block has four addresses: .0 (network), .1 and .2 (hosts), and .3 (broadcast). It has traditionally been used for numbered point-to-point links.
/31 — two endpoints, when supported
Under RFC 3021, both addresses of a /31 are usable as endpoints on supported IPv4 point-to-point links. For example, 198.51.100.0/31 uses both 198.51.100.0 and 198.51.100.1 as endpoint addresses; there is no conventional directed broadcast address within that pair.
Do not generalize /31 to ordinary LAN segments. RFC 3021 addresses point-to-point behavior. Check device and routing-platform compatibility before deploying it.
/32 — one specific address
A /32 identifies a single IPv4 address, such as 203.0.113.25/32. It is common in host routes, access control entries and loopback-related routing. Treat it as one address, not a normal multi-host subnet with a network and broadcast pair.
The 198.51.100.0/24 and 203.0.113.0/24 ranges used here are documentation-only address blocks defined by RFC 5737.
6. Practical VLSM plan for an office
VLSM (Variable Length Subnet Masking) allows different-sized subnets within an available address block. Imagine these requirements inside 192.168.10.0/24: 100 employee devices, 50 guest devices, 20 IoT devices and 10 infrastructure addresses. Start with the largest requirement and allocate non-overlapping prefixes.
| Segment | Needed | Assigned subnet | Usable hosts |
|---|---|---|---|
| Employee LAN | 100 | 192.168.10.0/25 | 126 |
| Guest Wi-Fi | 50 | 192.168.10.128/26 | 62 |
| IoT devices | 20 | 192.168.10.192/27 | 30 |
| Infrastructure | 10 | 192.168.10.224/28 | 14 |
| Unallocated reserve | — | 192.168.10.240/28 | 14 if assigned as a LAN |
VLSM improves allocation efficiency, but address planning must also account for future growth, default gateways, high-availability interfaces, platform reservations, and operational separation. Distinct IPv4 subnets do not, by themselves, enforce security: apply routing policy, firewalls or ACLs as needed.
7. Private IPv4 ranges and cloud subnet differences
RFC 1918 defines three private IPv4 blocks intended for internal networks:
| Private range | CIDR block | Common context |
|---|---|---|
| 10.0.0.0–10.255.255.255 | 10.0.0.0/8 | Larger private addressing plans |
| 172.16.0.0–172.31.255.255 | 172.16.0.0/12 | Private enterprise and cloud networks |
| 192.168.0.0–192.168.255.255 | 192.168.0.0/16 | Home, branch and private LAN networks |
Cloud planning caveat — AWS VPC: AWS reserves the first four and last one IPv4 address in every subnet. Therefore, a /26 still contains 64 addresses, but only 59 can be assigned to AWS resources. AWS also restricts IPv4 VPC subnet sizes to /28 through /16. These are AWS-specific operational rules, not changes to the CIDR formula.
For example, 10.0.0.64/26 in an AWS VPC has 64 total addresses; AWS reserves 10.0.0.64–67 and 10.0.0.127, leaving 10.0.0.68–126 for resource assignment. Always verify the provider’s current subnet restrictions and reservations rather than reusing the conventional total − 2 assumption.
8. Common subnetting mistakes to avoid
- Confusing total and usable addresses: a conventional /26 has 64 total, but 62 typical host addresses.
- Using an incorrect boundary: /26 networks advance in increments of 64 in the relevant octet.
- Overlapping VLAN or VPC ranges: keep planned CIDR blocks disjoint within the same routing context.
- Applying the /30 host formula to /31: RFC 3021 permits two point-to-point endpoints.
- Assuming every cloud reserves two addresses: provider reservations can differ significantly.
- Assuming subnet separation is a firewall: routing and security rules require their own configuration.
9. Frequently asked questions
How many usable hosts are in a /24?
A conventional IPv4 /24 contains 256 addresses and typically offers 254 usable host addresses: one address identifies the network, and one is the directed broadcast address.
Is a /26 larger or smaller than a /24?
A /26 is smaller. Increasing the prefix by two bits divides a /24 into four /26 blocks, each containing 64 total addresses.
Why does a /31 have two usable endpoints?
RFC 3021 defines special handling for IPv4 point-to-point links that support /31 numbering. Both addresses identify endpoints rather than reserving one network and one broadcast address as in a conventional LAN subnet.
What is the difference between CIDR and VLSM?
CIDR represents IP prefixes without classful address assumptions. VLSM is an address-planning technique that allocates multiple prefix sizes within an address space based on actual subnet requirements.
Can I use the full usable-host count in AWS?
No. AWS reserves five IPv4 addresses per subnet, so a /26 has 59 addresses assignable to resources instead of the conventional 62. Always consult your provider’s addressing rules.
Check your subnet calculations with NetOps Tools
Use the IPv4 Subnet Calculator to verify masks, network boundaries and host ranges. For authorized network diagnostics, the Nmap Command Generator helps assemble consistent scan commands.
10. Technical references
- RFC 4632 — Classless Inter-domain Routing (CIDR): prefix notation, aggregation and IPv4 block sizes.
- RFC 3021 — Using 31-Bit Prefixes on IPv4 Point-to-Point Links: two usable /31 endpoints.
- RFC 1918 — Address Allocation for Private Internets: reserved private IPv4 address space.
- RFC 5737 — IPv4 Address Blocks Reserved for Documentation: example-only address ranges.
- AWS VPC — Subnet CIDR Blocks: supported subnet sizes and IPv4 address reservations.