Practical Guide to CIDR Notation & IPv4 Subnetting

Category: Network Engineering Updated: November 28, 2026 Reading time: 9 minutes

Whether you are carving up a cloud VPC in AWS or Azure, writing firewall allowlists, or troubleshooting why two hosts on the same office switch cannot ping each other, CIDR subnetting is the core skill that makes IP addressing predictable.

1. What the Slash Number in CIDR Actually Means

Classless Inter-Domain Routing (CIDR) replaced rigid 1980s Class A/B/C boundaries with a flexible prefix length written after a slash, such as 10.20.4.0/24. Because an IPv4 address has 32 bits in total:

In standard subnets (/0 through /30), two addresses are reserved: the very first address (all host bits = 0) is the Network ID, and the very last address (all host bits = 1) is the Broadcast Address. That leaves 2(32 - prefix) - 2 usable host addresses.

2. Fast Mental Math: The "Magic Block Size" Trick

You do not need to write out 32 binary digits every time you inspect a subnet between /24 and /30. Subtract the mask's interesting octet from 256 to get the exact block size:

Example: 192.168.50.140/26
1. /26 has 26 network bits → 24 bits in first 3 octets + 2 bits in 4th octet.
2. Mask's 4th octet = 128 + 64 = 192  (Subnet mask: 255.255.255.192)
3. Block size = 256 - 192 = 64
4. Valid /26 boundaries start at multiples of 64: 0, 64, 128, 192
5. 140 falls inside [128 .. 191]:
   - Network ID:   192.168.50.128
   - First usable: 192.168.50.129
   - Last usable:  192.168.50.190
   - Broadcast:    192.168.50.191

The exact same block-size rule works in the third octet for prefixes /16 through /23 (for instance, a /22 has a third-octet mask of 252, giving a block size of 256 - 252 = 4 third-octet increments, or 1,024 total IPs).

3. Worked Example: Planning a Cloud VPC with VLSM

Suppose your team is allocated 10.20.0.0/22 (1,024 total IPs spanning 10.20.0.0 through 10.20.3.255) and needs to deploy a three-tier web application across two availability zones using Variable Length Subnet Masking (VLSM):

Tier / Subnet RoleCIDR BlockAddress RangeTotal IPsWhy This Size?
Public Load Balancers (AZ-a)10.20.0.0/2610.20.0.0 – .6364Only ALBs and NAT gateways sit in public subnets
Public Load Balancers (AZ-b)10.20.0.64/2610.20.0.64 – .12764Mirrored public subnet in second AZ
Database Tier (AZ-a)10.20.0.128/2610.20.0.128 – .19164Isolated private DB instances and replicas
Database Tier (AZ-b)10.20.0.192/2610.20.0.192 – .25564Multi-AZ standby database subnet
App / Kubernetes Tier (AZ-a)10.20.1.0/2410.20.1.0 – 10.20.1.255256Room for autoscaling pods and containers
App / Kubernetes Tier (AZ-b)10.20.2.0/2410.20.2.0 – 10.20.2.255256Mirrored private compute capacity
Reserved Future Growth10.20.3.0/2410.20.3.0 – 10.20.3.255256Unallocated buffer for new services or peering
Cloud Provider Reservation Caveat: While standard IPv4 reserves 2 addresses per subnet (network + broadcast), major cloud providers like AWS reserve 5 addresses per subnet (network ID, VPC router, internal DNS, future use, and broadcast). Keep that in mind before choosing a tight /28 subnet in the cloud!

4. Special Prefix Cases: /31 and /32

5. Wildcard Masks (Inverse Masks) for Router ACLs

Cisco IOS access control lists (ACLs) and OSPF area statements often require a wildcard mask instead of a subnet mask. A wildcard mask is simply the bitwise inverse of the subnet mask (subtract each octet from 255): where a subnet mask uses 1 to lock a bit, a wildcard mask uses 0 to match and 1 to ignore. For example, subnet mask 255.255.255.192 (/26) has wildcard mask 0.0.0.63.

6. Three Classic Subnetting Mistakes to Avoid

  1. Misaligned CIDR boundaries: Writing 192.168.1.100/26 is not a valid network boundary because 100 is not a multiple of 64; routers normalize it to 192.168.1.64/26.
  2. Overlapping VPC/VPN ranges: Using default 192.168.1.0/24 or 10.0.0.0/16 in every environment causes painful routing conflicts the moment you need site-to-site VPN or VPC peering. Pick distinct, non-overlapping slices of 10.0.0.0/8 from day one.
  3. Forgetting IPv6's /64 rule: In IPv6, LAN subnets should almost always be /64 so Stateless Address Autoconfiguration (SLAAC) functions properly. Do not subnet IPv6 LANs smaller than /64 just to "save addresses."
Put it into practice: Test any CIDR prefix, view its color-coded 32-bit binary mask, and split blocks automatically in our Interactive CIDR & Subnet Calculator →