The CIDR (Classless Inter-Domain Routing) notation tells you two things: the starting IP address and the size of your network.
The number after the slash (e.g., /16, /24) represents how many bits are “locked” for the network prefix. Since an IPv4 address has 32 bits in total, you subtract the CIDR number from 32 to find how many bits are left for your “hosts” (the actual devices).
๐ The “Rule of 32”
To calculate how many IPs you get, use this formula: $2^{(32 – \text{prefix})}$.
- Higher number = Smaller network:
/28is a small room. - Lower number = Larger network:
/16is a massive warehouse.
Common Azure CIDR Sizes
| CIDR | Total IPs | Azure Usable IPs* | Common Use Case |
/16 | 65,536 | 65,531 | VNet Level: A massive space for a whole company’s environment. |
/22 | 1,024 | 1,019 | VNet Level: Good for a standard “Hub” network. |
/24 | 256 | 251 | Subnet Level: Perfect for a standard Web or App tier. |
/27 | 32 | 27 | Service Subnet: Required for things like SQL Managed Instance. |
/28 | 16 | 11 | Micro-Subnet: Used for small things like Azure Bastion or Gateways. |
/29 | 8 | 3 | Minimum Size: The smallest subnet Azure allows. |
๐ซ The “Azure 5” (Critical)
In every subnet you create, Azure automatically reserves 5 IP addresses. You cannot use these for your VMs or Apps.
If you create a /28 (16 IPs), you only get 11 usable addresses.
- x.x.x.0: Network Address
- x.x.x.1: Default Gateway
- x.x.x.2 & x.x.x.3: Azure DNS mapping
- x.x.x.255: Broadcast Address
๐ก How to choose for your VNet?
When designing your Azure network, follow these two golden rules:
- Don’t go too small: It is very difficult to “resize” a VNet once it’s full of resources. It’s better to start with a
/16or/20even if you only need a few IPs today. - Plan for Peering: If you plan to connect VNet A to VNet B (Peering), their CIDR ranges must not overlap. If VNet A is
10.0.0.0/16, VNet B should be something completely different, like10.1.0.0/16.
Pro Tip: Think of it like a T-shirt sizing guide.
- Small:
/24(256 IPs) - Medium:
/22(1,024 IPs) - Large:
/20(4,096 IPs) - Enterprise:
/16(65,536 IPs)