CIDR Notation and Subnetting: A Complete Guide for Network Engineers
CIDR (Classless Inter-Domain Routing) notation is the standard way to express IP address ranges and subnet configurations. Whether you are provisioning cloud infrastructure on AWS or GCP, configuring firewall rules, designing VPC layouts, or troubleshooting network issues, understanding CIDR and subnetting is an essential skill for developers and network engineers alike.
What Is CIDR Notation?
CIDR notation combines an IP address with a prefix length, separated by a slash:
192.168.1.0/24
The number after the slash โ the prefix length โ indicates how many bits of the 32-bit IPv4 address are used to identify the network. The remaining bits identify individual hosts within that network.
For 192.168.1.0/24: the first 24 bits (192.168.1) identify the network, and the last 8 bits (the final octet) identify up to 254 usable hosts.
IPv4 Subnet Fundamentals
The Subnet Mask
The subnet mask is the traditional way to express the same information as a prefix length. A /24 prefix equals a subnet mask of 255.255.255.0 โ 24 consecutive binary ones followed by 8 zeros:
/24 = 11111111.11111111.11111111.00000000 = 255.255.255.0
/16 = 11111111.11111111.00000000.00000000 = 255.255.0.0
/8 = 11111111.00000000.00000000.00000000 = 255.0.0.0
Network, Broadcast, and Host Addresses
For any subnet, three special addresses are defined:
- Network address: All host bits set to 0 โ identifies the subnet (
192.168.1.0) - Broadcast address: All host bits set to 1 โ messages to all hosts (
192.168.1.255) - Usable host range: Everything in between (
192.168.1.1to192.168.1.254)
Usable hosts = 2(32 โ prefix) โ 2 (subtract 2 for network and broadcast).
Common Subnet Sizes and Their Uses
/8โ 16,777,214 usable hosts โ entire Class A range (e.g.,10.0.0.0/8)/16โ 65,534 usable hosts โ large corporate networks (e.g.,172.16.0.0/16)/24โ 254 usable hosts โ typical office or VPC subnet/28โ 14 usable hosts โ small subnet for a specific service tier/30โ 2 usable hosts โ point-to-point links between routers/32โ 1 address โ single host route, loopback
Private IP Address Ranges (RFC 1918)
These ranges are reserved for private networks and are not routable on the public internet:
10.0.0.0/8โ large private range, common in cloud VPCs172.16.0.0/12โ covers 172.16.x.x through 172.31.x.x192.168.0.0/16โ common in home and office networks
Subnetting โ Dividing a Network
Subnetting divides a larger network into smaller, more manageable subnets by extending the prefix length. Each additional bit borrowed doubles the number of subnets and halves the number of hosts per subnet.
Example: Split 10.0.0.0/24 into four equal /26 subnets:
10.0.0.0/26 โ hosts 10.0.0.1 โ 10.0.0.62 (62 usable)
10.0.0.64/26 โ hosts 10.0.0.65 โ 10.0.0.126 (62 usable)
10.0.0.128/26 โ hosts 10.0.0.129 โ 10.0.0.190 (62 usable)
10.0.0.192/26 โ hosts 10.0.0.193 โ 10.0.0.254 (62 usable)
Borrowing 2 bits from the host portion: 22 = 4 subnets, each with 26 โ 2 = 62 usable hosts.
Cloud Infrastructure Subnetting
When designing AWS VPCs, GCP VPCs, or Azure VNets, subnetting decisions have long-term consequences. Best practices:
- Start with a
/16VPC CIDR for maximum flexibility - Allocate
/24subnets per availability zone per tier (web, app, database) - Reserve a
/27or/28for NAT gateways and load balancers - Leave address space unallocated for future growth โ don't use the entire VPC range immediately
- Avoid overlapping CIDRs across VPCs if you plan to use VPC peering
IPv6 Subnetting
IPv6 addresses are 128 bits long, written as eight groups of four hex digits: 2001:db8:abcd:0012::1/64. The prefix length works identically to IPv4.
A /64 IPv6 subnet contains 264 host addresses โ roughly 18.4 quintillion. The standard practice is to always assign /64 subnets to individual network segments, since SLAAC (Stateless Address Autoconfiguration) requires a /64.
IPv6 Address Types
::1/128โ Loopback (equivalent to 127.0.0.1)fe80::/10โ Link-local (auto-configured, not routable)fc00::/7โ Unique local (private, RFC 4193)ff00::/8โ Multicast2000::/3โ Global unicast (publicly routable)
Calculate Subnets Instantly
The IPv4 and IPv6 Subnet Calculator on DataConvertProTools gives you complete subnet information instantly โ network address, broadcast address, first and last host, subnet mask, wildcard mask, binary representation, and a subnetting chart showing how the network can be divided. Enter any IP/CIDR notation and get results in under a second, entirely in your browser.
Calculate any subnet instantly: DataConvertProTools IPv4 & IPv6 Subnet Calculator โ full results including binary view, host ranges, and subnetting table. Free, private, no signup required.