> Markdown version of https://opspane.dev/network/vpc-subnet-planner/ for AI agents and readers: the same text, without navigation or the interactive tool.
>
> The tool computes its result with JavaScript in the browser, so this file holds the reference text, worked examples and FAQ. Open the page to run it on your own input.
>
> Link the VPC subnet planner with a plan: `vpc`, `az` (1–6), tier sizes `pub`, `prv`, `pod`, `int`, `db` (a prefix such as /24 or an address count) and `v6` (optional IPv6 VPC block for dual-stack), e.g. https://opspane.dev/network/vpc-subnet-planner/?vpc=10.0.0.0%2F16&v6=2001%3Adb8%3A1234%3A1a00%3A%3A%2F56
>
> Answer endpoint for agents: the same URL parameters on https://opspane.dev/network/vpc-subnet-planner/answer.md return the computed result as Markdown, without JavaScript, e.g. https://opspane.dev/network/vpc-subnet-planner/answer.md?vpc=10.0.0.0%2F16&az=3&pub=%2F24&prv=%2F20

# VPC Subnet Planner

Split a VPC CIDR into aligned subnets per AZ, sized by prefix or host count (EKS pods), with AWS usable IPs, dual-stack /64s and aws_subnet Terraform.

## Quick answer

- AWS reserves 5 addresses in every subnet: the network address, the VPC router, DNS, one for future use and the broadcast address. A /24 has 256 addresses and 251 usable.
- A subnet or VPC CIDR block is /16 to /28: a /28 has 11 usable addresses and a /16 has 65,531.
- EKS Pods subnet: nodes per AZ × max Pods per node. 30 m5.large nodes × 29 = 870 addresses, a /22 (1,019 usable).
- Place the largest subnets first so every block stays aligned without gaps; a subnet's IPv4 CIDR can't be resized later.

## How to plan VPC subnets across Availability Zones

1. Enter the VPC CIDR block — /16 to /28, ideally from a private range such as `10.0.0.0/16` — and how many Availability Zones to spread across. For a dual-stack VPC, add its IPv6 block too (the `/56` AWS assigned, or an IPAM block): every subnet gets the next `/64`.
2. Size each tier as a prefix (`/24`) or as the number of addresses it needs (`500`); the planner picks the smallest subnet whose usable count, after AWS's 5 reserved addresses, covers it. Leave a tier empty to skip it.
3. For a Pods tier, enter nodes per AZ and max Pods per node — the product becomes the size. The EKS Max Pods Calculator gives the per-node number for any instance type.
4. Read the plan: the bar shows where every subnet sits in the VPC, the table lists each CIDR with its usable range (and its IPv6 `/64`), and the free blocks are what's left for later. Copy the Terraform, or copy the link to share the exact plan.

## Worked example

A `10.0.0.0/16` VPC across 3 AZs with public `/24`, private `/20` and Pods `/19` subnets — the order the planner places them in:

| Subnet | CIDR | Usable IPs |
| --- | --- | --- |
| Pods a | `10.0.0.0/19` | 8,187 |
| Pods b | `10.0.32.0/19` | 8,187 |
| Pods c | `10.0.64.0/19` | 8,187 |
| Private a | `10.0.96.0/20` | 4,091 |
| Private b | `10.0.112.0/20` | 4,091 |
| Private c | `10.0.128.0/20` | 4,091 |
| Public a | `10.0.144.0/24` | 251 |
| Public b | `10.0.145.0/24` | 251 |
| Public c | `10.0.146.0/24` | 251 |

The Pods subnets come first because they are the largest; 37,632 of 65,536 addresses are allocated and 27,904 stay free as 5 aligned blocks starting at `10.0.147.0`.

## Subnet sizes and usable addresses

Usable addresses per subnet after each cloud's reservations, for every size AWS accepts. “Per /16 VPC” is how many subnets of that size fit in the largest VPC CIDR block.

| Prefix | Addresses | AWS usable | Azure usable | GCP usable | Per /16 VPC |
| --- | --- | --- | --- | --- | --- |
| `/16` | 65,536 | **65,531** | 65,531 | 65,532 | 1 |
| `/17` | 32,768 | **32,763** | 32,763 | 32,764 | 2 |
| `/18` | 16,384 | **16,379** | 16,379 | 16,380 | 4 |
| `/19` | 8,192 | **8,187** | 8,187 | 8,188 | 8 |
| `/20` | 4,096 | **4,091** | 4,091 | 4,092 | 16 |
| `/21` | 2,048 | **2,043** | 2,043 | 2,044 | 32 |
| `/22` | 1,024 | **1,019** | 1,019 | 1,020 | 64 |
| `/23` | 512 | **507** | 507 | 508 | 128 |
| `/24` | 256 | **251** | 251 | 252 | 256 |
| `/25` | 128 | **123** | 123 | 124 | 512 |
| `/26` | 64 | **59** | 59 | 60 | 1,024 |
| `/27` | 32 | **27** | 27 | 28 | 2,048 |
| `/28` | 16 | **11** | 11 | 12 | 4,096 |

## The 5 addresses AWS reserves

In every subnet the first four addresses and the last one can't be assigned to anything. For `10.0.0.0/24`:

| Address | Reserved for |
| --- | --- |
| `10.0.0.0` | Network address |
| `10.0.0.1` | VPC router |
| `10.0.0.2` | Amazon DNS (base of the VPC + 2) |
| `10.0.0.3` | Reserved for future use |
| `10.0.0.255` | Broadcast (not supported, still reserved) |

## Sizing subnets for EKS Pods

With the Amazon VPC CNI every Pod gets a VPC address, so the Pod subnet must hold nodes per AZ × max Pods per node. With custom networking (an `ENIConfig` per AZ) Pods draw from their own subnet — often in a secondary `100.64.0.0/10` CIDR — which is what the Pods tier models.

| Nodes per AZ | Instance | Max Pods | Pod IPs | Subnet | Usable | Headroom |
| --- | --- | --- | --- | --- | --- | --- |
| 10 | `m5.large` | 29 | 290 | `/23` | 507 | 217 |
| 30 | `m5.large` | 29 | 870 | `/22` | 1,019 | 149 |
| 20 | `m5.xlarge` | 58 | 1,160 | `/21` | 2,043 | 883 |
| 50 | `m5.2xlarge` | 58 | 2,900 | `/20` | 4,091 | 1,191 |

With prefix delegation the CNI hands out whole `/28` blocks (16 addresses) instead of single IPs, so the subnet needs free contiguous /28s — size generously and keep it dedicated, or the CNI fails with `InsufficientCidrBlocks`.

## Dual-stack: IPv6 blocks on AWS

A VPC can add IPv6 to its IPv4 range. AWS takes a VPC IPv6 block from `/44` to `/60` in steps of `/4`; the planner gives each subnet one `/64`, in the order of the table, and writes it in Terraform with `cidrsubnet()` on the VPC's own `ipv6_cidr_block`, so the plan follows whatever block AWS assigns.

| VPC IPv6 block | /64 subnets | Addresses | Where it comes from |
| --- | --- | --- | --- |
| `/44` | 1,048,576 | 2⁸⁴ | IPAM or BYOIP |
| `/48` | 65,536 | 2⁸⁰ | IPAM or BYOIP |
| `/52` | 4,096 | 2⁷⁶ | IPAM or BYOIP |
| `/56` | 256 | 2⁷² | Amazon-provided (always /56), IPAM, BYOIP |
| `/60` | 16 | 2⁶⁸ | IPAM or BYOIP |

The default plan as dual-stack, with the docs' example block `2001:db8:1234:1a00::/56`:

| Subnet | IPv4 CIDR | IPv6 CIDR | cidrsubnet netnum |
| --- | --- | --- | --- |
| Public a | `10.0.48.0/24` | `2001:db8:1234:1a00::/64` | 0 |
| Public b | `10.0.49.0/24` | `2001:db8:1234:1a01::/64` | 1 |
| Public c | `10.0.50.0/24` | `2001:db8:1234:1a02::/64` | 2 |
| Private a | `10.0.0.0/20` | `2001:db8:1234:1a03::/64` | 3 |
| Private b | `10.0.16.0/20` | `2001:db8:1234:1a04::/64` | 4 |
| Private c | `10.0.32.0/20` | `2001:db8:1234:1a05::/64` | 5 |

### The 5 IPv6 addresses AWS reserves

As for IPv4, the first four and the last address of each subnet's IPv6 block can't be assigned. For `2001:db8:1234:1a00::/64`:

| Address | Reserved for |
| --- | --- |
| `2001:db8:1234:1a00::` | Network address |
| `2001:db8:1234:1a00::1` | VPC router |
| `2001:db8:1234:1a00::2` | Reserved by AWS |
| `2001:db8:1234:1a00::3` | Reserved by AWS |
| `2001:db8:1234:1a00:ffff:ffff:ffff:ffff` | Reserved by AWS (last address) |

That leaves 2⁶⁴ − 5 addresses in a `/64`, so IPv6 never runs a subnet out of addresses the way a `/24` does. The Terraform sets `assign_ipv6_address_on_creation` to true so instances get an IPv6 address at launch (the provider default is false).

### Public (GUA) or private (ULA)?

An Amazon-provided block is global unicast — public and reachable from the internet once a route and security group allow it; an egress-only internet gateway gives private subnets outbound-only IPv6. Private IPv6 comes only from Amazon VPC IPAM: unique local space in `fd00::/8` outside Amazon's reserved `fd00::/16`, or a GUA range you own with the private option enabled. The planner refuses link-local, multicast and other special ranges, and `fd00::/16`.

Not modelled: IPv6-only subnets (they need Nitro instances and the VPC still needs an IPv4 block) and IPv6 subnet blocks larger than `/64`.

## Gotchas this tool checks for

### 172.17.0.0/16 collides with Docker

Docker's default bridge is `172.17.0.0/16`, and AWS warns that Cloud9 and SageMaker use it too: a host running Docker can't reach VPC addresses inside it. The planner warns when the VPC overlaps that range.

### Host bits in the VPC CIDR

`10.0.3.7/16` isn't a network address. The AWS API quietly stores it as `10.0.0.0/16`; the planner says so and plans with the canonical block.

### Ranges AWS refuses

`0.0.0.0/8`, loopback `127.0.0.0/8`, link-local `169.254.0.0/16` and multicast `224.0.0.0/4` can't be VPC ranges; a public range is accepted but hides the real owners of those addresses from the VPC, so it gets a warning.

## Verification

- The reserved addresses, the /16–/28 limits, the forbidden ranges and the 172.17.0.0/16 advice are quoted from the Amazon VPC User Guide (checked 2026-11-20); Azure's 5 and Google Cloud's 4 come from their own VPC documentation.
- The IPv6 rules — /44 to /60 VPC blocks in steps of /4, the Amazon-provided /56, five reserved IPv6 addresses per subnet, private IPv6 only through IPAM with fd00::/16 reserved — are from the same guide; the Terraform arguments from the AWS provider's aws_subnet and aws_vpc documentation.
- The engine's unit tests assert, for 300 seeded random plans and the boundary cases, that every subnet and free block is aligned to its size, sits inside the VPC and overlaps no other — plus exact vectors from /0 to /32 and 255.255.255.255.
- Parsing is as strict as Go's `net/netip`: leading zeros (`010.0.0.0`) are rejected because some tools read them as octal.
- The e2e spec proves the plan stays in this tab: no request carries your CIDR or sizes.

- [AWS: Subnet CIDR blocks](https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html)
- [AWS: VPC CIDR blocks](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-cidr-blocks.html)
- [AWS: IP addressing (IPv6)](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-ip-addressing.html)
- [Terraform: aws_subnet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet)
- [Amazon EKS: VPC and subnet requirements](https://docs.aws.amazon.com/eks/latest/userguide/network-reqs.html)
- [Azure Virtual Network FAQ](https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-faq)
- [Google Cloud: Subnets](https://cloud.google.com/vpc/docs/subnets)
- [RFC 1918](https://www.rfc-editor.org/rfc/rfc1918)

## FAQ

### How many usable IP addresses does a /24 subnet have in AWS?

251. A /24 holds 256 addresses and AWS reserves 5 in every subnet: in 10.0.0.0/24 those are 10.0.0.0, 10.0.0.1, 10.0.0.2, 10.0.0.3, 10.0.0.255 — the network address, the VPC router, DNS, one for future use and the broadcast address.

### What are the smallest and largest subnets AWS allows?

A subnet (and a VPC CIDR block) can be /28 to /16. A /28 has 16 addresses and 11 usable; a /16 has 65,536 and 65,531 usable. For more room, associate secondary CIDR blocks with the VPC — each is again /16 to /28.

### How big should a subnet for EKS Pods be?

Multiply nodes per AZ by max Pods per node: 30 m5.large nodes × 29 Pods = 870 addresses, which needs a /22 (1,019 usable on AWS). Type the product into the Pods tier — or the two numbers into the helper — and the planner picks the prefix. Add headroom for rolling updates, which run old and new Pods at once.

### Why are the largest subnets placed first?

Every block must start on a multiple of its own size. Put a /24 at 10.0.0.0 and the next /20 can't start until 10.0.16.0, wasting 3,840 addresses. Placing blocks from largest to smallest leaves no gaps, so a plan fits whenever the subnets' total is no bigger than the VPC — and the leftover space stays in one piece at the end.

### Do Azure and Google Cloud reserve the same addresses?

Azure also reserves 5 per subnet (network, default gateway, two for Azure DNS, broadcast), so a /24 has 251 usable. Google Cloud reserves 4 in a primary range (network, gateway, second-to-last and broadcast): 252 usable in a /24, and nothing in secondary ranges. This planner allocates for AWS; the table above compares all three.

### What IPv6 CIDR sizes does AWS allow for a VPC and a subnet?

A VPC IPv6 block is /44 to /60 in steps of /4, and an Amazon-provided block is always a /56 you can't choose; a VPC can hold up to five IPv6 blocks. Subnet IPv6 blocks are /44 to /64, also in steps of /4. A /56 holds 256 /64 subnets — the size this planner gives each subnet, and the one aws_subnet.ipv6_cidr_block is documented with.

### Does AWS reserve IPv6 addresses in a subnet?

Yes, the same five as for IPv4: the first four IPv6 addresses and the last one of every subnet block can't be assigned — in 2001:db8:1234:1a00::/64 that is 2001:db8:1234:1a00::, 2001:db8:1234:1a00::1, 2001:db8:1234:1a00::2, 2001:db8:1234:1a00::3, 2001:db8:1234:1a00:ffff:ffff:ffff:ffff. Against a /64's 2⁶⁴ addresses the loss doesn't matter, so the planner doesn't count IPv6 usable addresses.

### Can I resize a subnet after creating it?

No. AWS fixes a subnet's IPv4 CIDR at creation — to grow, create a new subnet in free space and move workloads, or add a secondary CIDR block to the VPC. That is why the planner shows the free space it leaves: keep a few aligned blocks spare for the subnets you will need later.

## Related tools

- [CIDR Overlap Checker](https://opspane.dev/network/cidr-overlap/): Paste labeled IPv4 or IPv6 CIDRs to find every overlap and containment, the merged summary routes, host-bit fixes and private or public ranges.
- [EKS Max Pods Calculator](https://opspane.dev/kubernetes/eks-max-pods/): Calculate max pods per node for every EC2 instance type, with prefix delegation and the IP addresses your pod CIDR must hold.
- [Kubernetes Pod & Service CIDR Planner](https://opspane.dev/kubernetes/pod-cidr/): Max nodes and Pods per node from --node-cidr-mask-size, Service CIDR limits, kube-dns IP and overlaps for IPv4, IPv6 and dual-stack clusters.
- [Kubernetes Secret Decoder](https://opspane.dev/kubernetes/secret-decoder/): Decode every value in a Kubernetes Secret from pasted YAML and encode data back into a manifest. Nothing leaves your browser.
