CIDR Cheat Sheet: Subnet Sizes, Private Ranges and IPv6 Prefixes
Checked against CIDR / IP addressing RFC 4632, 1918, 6598, 3021, 4291, 4193; AWS VPC docs; maths run on Python 3.12.8 ipaddress on 28 November 2026. Each section links to the official docs it was checked against.
This sheet is for developers who size VPCs, write firewall rules or read Kubernetes pod ranges and want the numbers without doing binary in their head. Every count in the tables was computed with Python 3.12.8's ipaddress module, and the ranges come from the RFCs that define them. The cloud rows follow the AWS VPC subnet sizing page as it read on the day.
When to use what
A prefix length is just how many leading bits are fixed. Each step down doubles the block: a /24 holds 256 addresses, a /23 holds 512, a /16 holds 65,536. For classic LANs subtract two (the network and broadcast addresses); on AWS subtract five, because the provider also keeps the first three host addresses.
For private networks pick from the RFC 1918 blocks and leave room. I'd give a VPC a /16 out of 10.0.0.0/8 and carve /20 or /24 subnets from it, because peering, VPNs and container networks all fail when two sides use the same range, and renumbering later is painful. Avoid 100.64.0.0/10 for your own LAN: it is the shared space carriers use for carrier-grade NAT, so it can collide with a customer's ISP.
IPv6 turns the problem upside down. Addresses are not scarce, a normal subnet is always a /64, and the planning question is how many /64s you need. A /48 gives you 65,536 of them and a /56 gives 256. Our CIDR calculator and subnet calculator do the splitting for you, and the IP addressing guide explains the binary behind it.
Usable hosts = addresses minus network and broadcast. For /31 and /32 see the next section.
/8 255.0.0.016,777,216 addresses, 16,777,214 usable hosts
/12 255.240.0.01,048,576 addresses, 1,048,574 usable hosts
/16 255.255.0.065,536 addresses, 65,534 usable hosts
/20 255.255.240.04,096 addresses, 4,094 usable hosts
/22 255.255.252.01,024 addresses, 1,022 usable hosts
/23 255.255.254.0512 addresses, 510 usable hosts
/24 255.255.255.0256 addresses, 254 usable hosts
/25 255.255.255.128128 addresses, 126 usable hosts
/26 255.255.255.19264 addresses, 62 usable hosts
/27 255.255.255.22432 addresses, 30 usable hosts
/28 255.255.255.24016 addresses, 14 usable hosts
/29 255.255.255.2488 addresses, 6 usable hosts
/30 255.255.255.2524 addresses, 2 usable hosts
/30 255.255.255.252Old point-to-point choice: 4 addresses, only 2 usable
/31 255.255.255.254Point-to-point link with both addresses usable and no broadcast (RFC 3021)
/32 255.255.255.255A single host; used in routes, security groups and allow lists
::/128 and ::1/128IPv6 unspecified and loopback addresses, each a single address
Shared space is RFC 6598 and IPv4 link-local is RFC 3927. Python's is_private returns False for 100.64.0.0/10 because it is neither private nor global.
10.0.0.0/8Private: 10.0.0.0 to 10.255.255.255, about 16.7 million addresses
172.16.0.0/12Private: 172.16.0.0 to 172.31.255.255, so 172.32.0.1 is public
192.168.0.0/16Private: 192.168.0.0 to 192.168.255.255, the usual home and office range
100.64.0.0/10Shared address space for carrier-grade NAT, ending at 100.127.255.255
169.254.0.0/16IPv4 link-local, self-assigned when DHCP fails
Unique local addresses are RFC 4193. Python agreed with every compressed and expanded form below.
fe80::/10Link-local; every IPv6 interface has one, never routed
fc00::/7 (fd00::/8 in practice)Unique local addresses; locally assigned ones set the L bit, giving fd
ff00::/8Multicast range; IPv6 has no broadcast, so groups use these
::ffff:192.0.2.1IPv4-mapped IPv6 address, as seen in dual-stack server logs
2001:db8::ff00:42:8329Compressed form of 2001:0db8:0000:0000:0000:ff00:0042:8329; :: may appear only once
/64Standard subnet size; interface IDs are 64 bits for normal unicast
/48 = 65,536 x /64, /56 = 256 x /64How many /64 subnets common site allocations hold
Other clouds keep their own reserved addresses; check their docs before reusing these numbers there.
/16 to /28Allowed IPv4 subnet sizes in a VPC
x.x.x.0, .1, .2, .3 and lastReserved: network, VPC router, DNS, future use, broadcast
/24 subnet256 addresses, 251 you can assign once AWS takes five
/28 subnet16 addresses, 11 assignable, the smallest subnet AWS allows
IPv6 /44 to /64 in steps of /4Allowed IPv6 subnet sizes; AWS also reserves five addresses per IPv6 subnet
ip_network('192.168.10.5/24')Raises ValueError 'has host bits set'; the network must start on a boundary
ip_network('192.168.10.5/24', strict=False)Masks the host bits and returns 192.168.10.0/24
list(net.subnets(new_prefix=26))Split a /24 into four /26 blocks
net.supernet(new_prefix=22)The /22 that contains 192.168.10.0/24 is 192.168.8.0/22
collapse_addresses([10.1.0.0/24, 10.1.1.0/24])Merge adjacent blocks; these two become 10.1.0.0/23
a.overlaps(b)True when two ranges share any address; run it before peering two VPCs
ip_address('192.0.2.94').reverse_pointerGives 94.2.0.192.in-addr.arpa, the name for its PTR record
Worked example: Split a /24 into four AWS subnets
Say you have 192.168.10.0/24 for one VPC and need four subnets: public and private in two availability zones. Python does the maths:
import ipaddress as ip
net = ip.ip_network("192.168.10.0/24")
for s in net.subnets(new_prefix=26):
print(s, s.num_addresses, s.num_addresses - 5)
s = ip.ip_network("192.168.10.64/26")
print(s.network_address + 1, s.broadcast_address - 1, s.broadcast_address)
The split we captured gave 192.168.10.0/26, 192.168.10.64/26, 192.168.10.128/26 and 192.168.10.192/26. Each block holds 64 addresses. On a normal LAN 62 of them would be usable, but on AWS you get 59, because the provider keeps the network address, the next three (router, DNS, reserved) and the last one. For the second block the host range printed as 192.168.10.65 to 192.168.10.126, with 192.168.10.127 as the broadcast; AWS then also keeps .65, .66 and .67, so your first instance lands on .68 at the earliest.
If 59 hosts feels tight for a private subnet running containers, it is. If each container gets its own address, a /26 can run out long before the CPU does. Give the VPC a /16 and use /20 subnets instead, and check the plan in the subnet calculator before you create anything.
Common mistakes
Writing
10.0.5.0/16in a config and assuming it means the 10.0.5.x range.The prefix wins: that is 10.0.0.0/16 with host bits set, and strict parsers reject it. Write the real network address, which Python's
strict=Falsewill show you.Treating 172.16.0.0/12 as only the 172.16.x.x range.
It covers 172.16.0.0 through 172.31.255.255. Anything from 172.32 up is public space.
Planning AWS capacity with the classic 'minus two' rule.
AWS reserves five addresses per subnet, so a /24 gives 251 and a /28 gives 11. Plan with the AWS numbers.
Using 100.64.0.0/10 for an office or VPN because it looks unused.
It is shared space for carrier-grade NAT, so a user's ISP may already route it. Pick from the RFC 1918 blocks instead.
Giving IPv6 subnets a /120 or /112 to 'save addresses'.
Normal unicast interface IDs are 64 bits, so a /64 per subnet is the norm. Use /64 per subnet and plan by counting /64s.
Building two VPCs, or a VPC and a home network, from the same 10.0.0.0/16.
Peering and VPNs need non-overlapping ranges. Run
overlaps()or paste both ranges into the CIDR calculator during planning, not after. Our IP lookup tells you who owns a public address if you are unsure.
Related cheat sheets
Sources
- https://www.rfc-editor.org/rfc/rfc4632.txt
- https://www.rfc-editor.org/rfc/rfc1918.txt
- https://www.rfc-editor.org/rfc/rfc6598.txt
- https://www.rfc-editor.org/rfc/rfc3021.txt
- https://www.rfc-editor.org/rfc/rfc4291.txt
- https://www.rfc-editor.org/rfc/rfc4193.txt
- https://www.rfc-editor.org/rfc/rfc3927.txt
- https://docs.aws.amazon.com/vpc/latest/userguide/subnet-sizing.html
- https://docs.python.org/3/library/ipaddress.html
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.