CIDR notation such as 10.0.0.0/22 packs a network and its size into one string. The prefix length says how many bits are the network; the rest are hosts. From that you can derive every fact about the block, which is what you need when carving up a VPC or checking whether two ranges overlap.
What you'll learn
- Read a prefix length and turn it into a subnet mask
- Compute total and usable addresses with 2^(32 − prefix)
- Find the first and last usable host of a block
Step by step
-
Enter the CIDR block
Open the CIDR / Subnet Calculator and type an address with a prefix, for example 192.168.1.130/25. Results update as you type.
-
Read the block facts
Network address, broadcast, subnet and wildcard masks, total addresses and the usable range are shown together.
10.0.0.0/22 Network: 10.0.0.0 Broadcast: 10.0.3.255 Mask: 255.255.252.0 Total: 1,024 Usable: 10.0.0.1 – 10.0.3.254 (1,022 hosts)
-
Apply the formula
Usable hosts = 2^(32 − prefix) − 2, the two being network and broadcast. /24 gives 254, /22 gives 1,022, /16 gives 65,534.
-
Mind the special cases
A /31 has two usable addresses for point-to-point links (RFC 3021) and a /32 is a single host.
Common problems
That is not a valid IPv4 address
Each of the four octets must be 0–255 and the prefix 0–32. 999.1.1.1/40 fails on both counts.
Do two subnets overlap?
Calculate both ranges and compare the first and last addresses. If either range contains the other's network address, they overlap.
FAQ
Does it support IPv6?
Not yet. It handles IPv4 blocks, which is where most VPC and office sizing questions live.