VPC Subnet Calculator
IPv4 + IPv6 subnet calculator with VLSM, IaC export, and AWS sizing cheat sheet
Calculate CIDR ranges, subnet masks (dotted, hex, binary, wildcard), and per-provider reserved IPs for AWS, GCP, Azure, and Oracle — for both IPv4 and IPv6. Split into equal subnets or variable-sized VLSM allocations. Export as Terraform, Ansible, AWS CloudFormation, Pulumi (TypeScript), JSON, or plain text. Includes a full AWS VPC sizing cheat sheet with concrete layouts for startup, small-business, mid-market, and enterprise workloads.
Input
AWS reserves 5 IPs per subnet — the first four and the broadcast.
Results
ExportTerraform (.tf)
Calculate a subnet first — exports will appear here.
Related developer tools
AWS VPC Subnet Sizing Cheat Sheet
Recommended CIDR layouts for typical AWS workloads, plus a complete /16–/30 reference table with masks, wildcard masks, and concrete usable-IP counts (after AWS's 5 reserved IPs per subnet).
CIDR reference table (AWS-aware usable counts)
| CIDR | Total IPs | Usable (AWS) | Subnet mask | Wildcard | Typical use |
|---|---|---|---|---|---|
| /30 | 4 | 0 | 255.255.255.252 | 0.0.0.3 | Point-to-point links (deprecated for AWS, use /28+) |
| /29 | 8 | 3 | 255.255.255.248 | 0.0.0.7 | Tiny subnets (limited AWS support) |
| /28 | 16 | 11 | 255.255.255.240 | 0.0.0.15 | AWS minimum subnet size · small services |
| /27 | 32 | 27 | 255.255.255.224 | 0.0.0.31 | Database subnets · small ECS clusters |
| /26 | 64 | 59 | 255.255.255.192 | 0.0.0.63 | App tiers · medium services |
| /25 | 128 | 123 | 255.255.255.128 | 0.0.0.127 | Medium deployments |
| /24 | 256 | 251 | 255.255.255.0 | 0.0.0.255 | Standard subnet · 2-AZ setups |
| /23 | 512 | 507 | 255.255.254.0 | 0.0.1.255 | Large app tiers |
| /22 | 1,024 | 1,019 | 255.255.252.0 | 0.0.3.255 | EKS node subnets · auto-scaling |
| /21 | 2,048 | 2,043 | 255.255.248.0 | 0.0.7.255 | Large auto-scaling groups |
| /20 | 4,096 | 4,091 | 255.255.240.0 | 0.0.15.255 | Per-environment tier · EKS pod CIDR |
| /19 | 8,192 | 8,187 | 255.255.224.0 | 0.0.31.255 | Multi-tier VPC subnet (rare) |
| /18 | 16,384 | 16,379 | 255.255.192.0 | 0.0.63.255 | Mid-market VPC |
| /17 | 32,768 | 32,763 | 255.255.128.0 | 0.0.127.255 | Large VPC |
| /16 | 65,536 | 65,531 | 255.255.0.0 | 0.0.255.255 | AWS maximum VPC size · enterprise default |
AWS reserves 5 IPs per subnet (.0, .1, .2, .3, and .255 in a /24). The “Usable” column reflects this.
Recommended layouts by scale
Concrete subnet patterns for typical AWS workloads. Each tier uses the smallest CIDR that fits without exhausting headroom too quickly.
Startup (< 50 instances)
VPC 10.0.0.0/24Small business (50–500 instances)
VPC 10.0.0.0/20Mid-market (500–2,000 instances)
VPC 10.0.0.0/18Enterprise (2,000+ instances)
VPC 10.0.0.0/16EKS pod CIDR sizing (the #1 footgun)
By default, EKS gives every pod a real VPC IP — so the VPC subnets must be large enough to host every pod, not just every node. This is the most common reason new EKS clusters run out of IPs.
(max pods per node) × (max nodes). A 100-node cluster with 30 pods each = 3,000 IPs minimum (use a /19 at least).100.64.0.0/16) so the main VPC isn't exhausted. The mid-market and enterprise layouts above show this pattern.Multi-AZ pattern (the canonical AWS layout)
For high availability, replicate every tier across at least 2 AZs (3 for production). With a /22 per tier-AZ pair, a /16 VPC fits 16 unique tier-AZ combinations.
VPC 10.0.0.0/16 (65,536 addresses) ├── Public AZ-A 10.0.0.0/22 (1,022 usable) ├── Public AZ-B 10.0.4.0/22 (1,022 usable) ├── Public AZ-C 10.0.8.0/22 (1,022 usable) ├── App AZ-A 10.0.16.0/22 (1,022 usable) ├── App AZ-B 10.0.20.0/22 (1,022 usable) ├── App AZ-C 10.0.24.0/22 (1,022 usable) ├── DB AZ-A 10.0.32.0/24 (251 usable) ├── DB AZ-B 10.0.33.0/24 (251 usable) ├── DB AZ-C 10.0.34.0/24 (251 usable) └── Mgmt 10.0.48.0/26 (59 usable)
VPC Subnet Reference
The math, the RFC numbers, and the cloud-provider quirks behind CIDR / subnetting — enough to design a VPC end-to-end without leaving the page.
Understanding CIDR notation
CIDR (Classless Inter-Domain Routing) combines an IP address with a prefix length: 10.0.0.0/24 means the first 24 bits identify the network, leaving 8 bits for hosts (256 addresses total, 254 usable after network + broadcast — or 251 on AWS where 5 are reserved). The prefix maps directly to a binary mask: /24 = 11111111.11111111.11111111.00000000 = 255.255.255.0.
RFC 1918 private IPv4 ranges
IPv6 prefix sizes worth knowing
| Prefix | Subnets / hosts | Typical use |
|---|---|---|
| /32 | 65,536 /48 site allocations | ISP block assigned by a regional registry. |
| /48 | 65,536 /64 subnets | Standard organization / site allocation. |
| /56 | 256 /64 subnets | Residential / SOHO allocation (common ISP default). |
| /64 | One subnet, 2⁶⁴ hosts | Standard IPv6 subnet — required for SLAAC. |
| /126 | 4 addresses, 2 usable | Legacy point-to-point (rarely used). |
| /127 | 2 addresses, 2 usable | RFC 6164 point-to-point inter-router links. |
Rule of thumb: never subnet smaller than /64 unless you have a specific reason. SLAAC, mobile IPv6, and many CNI plugins require /64.
Cloud provider reserved-IP quirks
.0network address.1VPC router.2DNS server.3reserved for future use.255broadcast (not used by AWS but reserved)
.0network address.1default gateway.2,.3Azure DNS.255broadcast
.0network address.1default gateway- Second-to-last address
- Last address (broadcast)
.0network address.1subnet default gateway.255broadcast
Best practices for VPC design
- Start with /16 for production VPCs, even if you don't need the addresses today. Resizing later means migration pain.
- Plan for 3 AZs, not 2 — Lambda and several managed services require at least 2 AZs and AWS recommends 3 for HA.
- Use separate CIDR blocks per environment(prod / staging / dev) so VPC peering doesn't cause conflicts.
- Reserve IP space before allocating — leave gaps between tiers for future expansion.
- Document the allocation— IPAM tools (AWS VPC IPAM, Infoblox, Netbox) prevent the “who owns this CIDR” problem.
- Don't use 172.17.0.0/16as your VPC CIDR — that's the default Docker bridge, and containers running on EC2 instances will lose connectivity.
Useful RFCs
- RFC 1918 — IPv4 private address space (10.0/8, 172.16/12, 192.168/16)
- RFC 4193 — IPv6 unique local addresses (fc00::/7)
- RFC 4291 — IPv6 addressing architecture
- RFC 6164 — Using /127 prefixes on inter-router links
- RFC 6177 — IPv6 address assignment to end sites (the /48 vs /56 debate)
- RFC 6303 — Locally-served DNS zones
Frequently Asked Questions
Common questions about VPC subnets, CIDR notation, IPv6 prefixes, EKS pod CIDR sizing, and AWS reserved IPs.