Subnet Calculator: CIDR Cheat Sheet & VPC Sizing Guide

Subnet calculator showing CIDR /27 network ID, usable host range and broadcast address for a cloud VPC subnet

You spin up a new VPC on a Friday afternoon, carve out subnets from memory, and by Monday the autoscaler is throwing InsufficientFreeAddressesInSubnet errors. One wrong prefix length did that. This guide gives you a CIDR cheat sheet first, then explains what a subnet calculator does under the hood, so you can sanity-check any plan.

Subnetting is just splitting one large network into smaller, logically separate segments. Each segment gets its own address range, its own routing rules and its own security boundary. Done well, your database tier can’t be reached from the internet-facing tier, and a broadcast storm in one segment stays in that segment.

You can do the binary by hand, and you should know how. But most engineers keep a fast online subnet calculator open in a tab, because the cost of an off-by-one error is a rebuilt subnet, and in the cloud that often means a rebuilt environment.

Quick-Reference CIDR Subnet Cheat Sheet

Keep this table next to whatever subnet calculator you use. It covers the prefixes you will meet in 90% of real designs.

CIDR PrefixSubnet MaskTotal IPsUsable Hosts (classic)Typical Use Case
/24255.255.255.0256254Standard office VLAN, one app tier in one AZ
/25255.255.255.128128126Half a floor, DMZ segment
/26255.255.255.1926462Server VLAN, small private tier
/27255.255.255.2243230Small Kubernetes node pool, load balancer subnet
/28255.255.255.2401614Smallest AWS subnet, NAT gateways, monitoring hosts
/29255.255.255.24886Small proxy pool, management network on-prem
/30255.255.255.25242Point-to-point router link

Three notes on the table:

  • “Usable” means total addresses minus the network ID and the broadcast address. Cloud providers reserve more, which we cover below.
  • A /31 (2 addresses) is valid for point-to-point links under RFC 3021, and many routers support it. A /32 is a single host route.
  • Every step down in prefix length halves the address count. Memorise that and the table rebuilds itself.

What a Subnet Calculator Actually Does Behind the Scenes

Every IPv4 address is 32 bits. The CIDR prefix tells you how many of those bits, counted from the left, belong to the network. The rest are host bits. A /27 means 27 network bits (1s) and 5 host bits (0s).

Take 192.168.10.77/27. A good ipv4 subnet calculator does this:

  • CIDR subnet mask: 27 ones is 11111111.11111111.11111111.11100000, which is 255.255.255.224.
  • Network ID: AND the address with the mask. The last octet 77 (01001101) ANDed with 224 (11100000) gives 01000000, which is 64. The network is 192.168.10.64.
  • Broadcast address calculation: set every host bit to 1. That’s 01011111, or 95. Broadcast is 192.168.10.95.
  • Usable host range: everything between the two, so 192.168.10.65 to 192.168.10.94. That’s 30 hosts, which is 2⁵ − 2.
  • Wildcard mask: invert the subnet mask to get 0.0.0.31. You need this for Cisco ACLs and OSPF network statements, which is why network ID and wildcards usually appear side by side in the output.

The tool is not doing anything mysterious. It is doing bit arithmetic quickly and without typos.

Why Skipping the Subnet Calculator Causes Outages

Hand math fails in boring, predictable ways.

Off-by-one host counts. People remember 2ⁿ and forget the minus two. A /28 is 16 addresses, not 16 hosts.

Cloud providers reserve more than two. In AWS, every subnet loses five addresses: the network address, the VPC router (.1), the DNS resolver (.2), one reserved for future use (.3), and the broadcast address. A /28 gives you 11 usable IPs, not 14. GCP and Azure have their own reserved counts, so check the documentation for whichever cloud you build on.

Services eat addresses you never counted. An Application Load Balancer wants free addresses in each of its subnets, and AWS recommends at least a /27 for that reason. Lambda in a VPC, interface endpoints and managed databases each take addresses of their own.

Wrong boundaries. 10.0.5.0/23 is not a valid network ID, because a /23 has to start on an even third octet. A calculator rejects it immediately. Your brain, at 6 p.m. before a change window, might not.

Planning IPs for Cloud and Enterprise Networks with a Subnet Calculator

VPC design: public vs private

The classic pattern still holds. Public subnets hold only what must face the internet: load balancers, NAT gateways, maybe a bastion. Private subnets hold application servers, and a separate set of isolated subnets holds databases with no route to the internet at all.

Public subnets can be small, since a pair of /28s per AZ covers NAT and a bastion. Private application subnets should be generous. Resizing a subnet later means migrating everything in it, and AWS does not let you change a subnet’s CIDR in place.

Containers eat IPs quickly

With the AWS VPC CNI, every pod gets a real VPC address. A modest 20-node cluster can consume several hundred IPs once pods, nodes and warm pools are counted, so a /27 node pool is a trap and a /22 is a more realistic starting point. If you run out, a secondary CIDR such as 100.64.0.0/10 for pods is a common escape hatch.

Two smaller traps are worth knowing. Docker’s default bridge uses 172.17.0.0/16, which can collide with a corporate range you are about to peer with. And overlapping VPC CIDRs make peering and Transit Gateway routing impossible, so decide your address plan across all accounts before the first VPC exists.

How a Crawling and Link-Verification Stack Segments Its Network

Link-building and technical SEO operations make a good worked example, because their workloads are noisy and uneven. A platform like Links Builder Hub runs link verification, SERP auditing and client reporting. Those jobs have very different traffic shapes, and a sensible network layout keeps them from interfering with each other.

Here is one way to lay it out inside a 10.40.0.0/16 VPC:

PurposeCIDRNotes
NAT and bastion (public), AZ-a / AZ-b10.40.0.0/28, 10.40.0.16/2811 usable IPs each in AWS
Crawler workers (private), per AZ10.40.16.0/24Autoscaled, short-lived instances
Monitoring cluster10.40.32.0/28Dashboards, alerting, metrics
Egress proxy pool10.40.33.0/28Stable outbound addresses
Reporting API and database10.40.48.0/26Isolated from crawler traffic

The reasoning behind it:

  • Separate crawlers from reporting. A burst of link-verification jobs can’t starve the API that clients use to pull their reports, because they live in different subnets with different route tables and security groups.
  • Stable egress. Pinning outbound traffic to a small, known proxy subnet gives you predictable source IPs for allowlisting and for tracing problems.
  • Small blocks for small fleets. A monitoring cluster of a handful of hosts does not need a /24.

One caveat on size. AWS will not create a subnet smaller than /28, so a /29 only works in a provider that allows it, on-prem, or as an allocation slice inside a larger subnet. And subnetting is about isolation and address hygiene, not about getting around rate limits. A well-behaved crawler still respects robots.txt and sensible request rates.

The Magic Number Method: Verify Any Subnet Calculator Result by Hand

You can check a subnet calculator output in your head with one subtraction. Find the “interesting octet”, which is the one where the mask is neither 255 nor 0. Then:

Block size = 256 − the mask value in that octet.

Subnets start at multiples of the block size.

Example 1: 192.168.10.77/27. The mask is 255.255.255.224, so the interesting octet is the fourth. Block size is 256 − 224 = 32. Subnet starts are 0, 32, 64, 96. The address 77 sits in the 64 block, so the network is .64, the broadcast is .95 (the next start, minus one), and usable hosts run from .65 to .94.

Example 2: 10.20.37.5/20. The mask is 255.255.240.0, so the interesting octet is the third. Block size is 256 − 240 = 16. The starts are 0, 16, 32, 48. The value 37 falls in the 32 block. The network is 10.20.32.0 and the broadcast is 10.20.47.255.

The block sizes worth memorising are 128, 64, 32, 16, 8 and 4 for /25 through /30. Everything else follows.

IP planning steps

  1. Count the hosts you need today, then double it for growth.
  2. Add the provider’s reserved addresses, such as 5 per subnet in AWS, plus whatever managed services will consume.
  3. Round up to the next power of two to get the block size.
  4. Allocate the largest blocks first, on aligned boundaries, and keep each environment inside one contiguous range so it summarises cleanly in routing tables.
  5. Leave gaps. An unallocated /20 between environments costs nothing and saves a migration.
  6. Run every candidate through your subnet calculator, and paste the usable host range, network ID and broadcast address into your design document.

Conclusion

Future-proof your address plan before anything runs in production: plan for growth, account for provider-reserved IPs, avoid overlapping ranges across accounts, and keep room between environments. Use the cheat sheet for quick decisions and the magic number method for spot checks, and let a subnet calculator confirm the final numbers before you commit them to Terraform.

1 thought on “Subnet Calculator: CIDR Cheat Sheet & VPC Sizing Guide”

  1. Pingback: JWT Decoder: Inspect Tokens and Fix 401 Errors Fast

Leave a Comment

Your email address will not be published. Required fields are marked *