The 5 IP addresses AWS reserves in every subnet
A subnet in AWS has 5 addresses fewer than its CIDR block: the first four and the last one cannot be assigned to an instance, a load balancer or any other resource. In 10.0.0.0/24 they are:
| Address | Used for |
|---|---|
10.0.0.0 | The network address |
10.0.0.1 | The VPC router |
10.0.0.2 | The Amazon DNS server - at the base of the VPC range plus two; in every other subnet the base plus two is reserved too |
10.0.0.3 | Reserved for future use |
10.0.0.255 | The broadcast address - a VPC does not support broadcast, so it is reserved |
So a /24 has 251 usable addresses, not 256 - and not 254 as in a classic network, which only loses the network and broadcast addresses. The smallest subnet, a /28, keeps 11 of its 16.
Subnet sizes
| Netmask | Addresses | Usable in AWS |
|---|---|---|
/16 | 65,536 | 65,531 |
/17 | 32,768 | 32,763 |
/18 | 16,384 | 16,379 |
/19 | 8,192 | 8,187 |
/20 | 4,096 | 4,091 |
/21 | 2,048 | 2,043 |
/22 | 1,024 | 1,019 |
/23 | 512 | 507 |
/24 | 256 | 251 |
/25 | 128 | 123 |
/26 | 64 | 59 |
/27 | 32 | 27 |
/28 | 16 | 11 |
Both a VPC and a subnet take a CIDR block from /16 to /28. Subnets of one VPC cannot overlap, and a subnet's CIDR block cannot be changed after it is created - so leave room: the calculator shows how much of the VPC is left for subnets you add later. The default VPC is 172.31.0.0/16 with a /20 subnet in each Availability Zone.
Choosing the VPC CIDR block
- Use a private range from RFC 1918 -
10.0.0.0/8,172.16.0.0/12or192.168.0.0/16. A public range works, but traffic to those addresses on the internet then stays inside the VPC. - Avoid
172.17.0.0/16: some AWS services, such as SageMaker AI and Cloud9, use it. 0.0.0.0/8,127.0.0.0/8,169.254.0.0/16and224.0.0.0/4are not allowed.- Plan ranges that do not overlap with your other VPCs and your on-premises network: VPC peering, Transit Gateway and VPN connections need distinct CIDR blocks.
- A VPC can get secondary CIDR blocks later, but its primary block cannot be resized.
Subnets and Availability Zones
A subnet lives in exactly one Availability Zone. For high availability, create the same set of subnets in at least two zones: e.g. a public subnet (with a route to an internet gateway) and a private subnet in each. The calculator assigns the subnets to zones in turn, and the code picks the zones of the region you deploy to.
Frequently asked questions
How many usable IP addresses are in a /24 subnet in AWS?
251: AWS reserves 5 of its 256 addresses - the first four and the last one.
Why does AWS reserve 5 IP addresses instead of 2?
On top of the network and broadcast addresses, AWS takes the second address for the VPC router, the third for DNS and the fourth for future use.
What is the smallest subnet in AWS?
A /28: 16 addresses, 11 usable. The largest is a /16 with 65,531 usable.
Does the calculator handle IPv6?
Not yet. An IPv6 subnet in AWS is /44 to /64 and also has 5 reserved addresses; with 264 addresses in a /64, running out is not the problem it is in IPv4.
Is my CIDR block sent anywhere?
No. The calculation runs in your browser: nothing you enter is uploaded, processed on a server or stored. The page only counts that the calculator was used, with the subnet size and number chosen, never the CIDR block.
References
Subnet CIDR blocks (Amazon VPC User Guide)
VPC CIDR blocks (Amazon VPC User Guide)
Terraform: cidrsubnet function