Demystifying CIDR & IP Subnetting: A Practical Guide for Developers
Whether configuring an AWS VPC security group, establishing Kubernetes Pod CIDR boundaries, or auditing firewall rules, developers encounter IP addresses with slash notation (like 10.0.0.0/16 or 192.168.1.0/24) every day.
To many engineers, subnet math feels unintuitive. In this guide, we break down the 32-bit architecture of IPv4, explain how binary bitwise AND operations partition networks, and provide clear formulas to calculate usable host ranges.
1. The Anatomy of an IPv4 Address
An IPv4 address is simply a 32-bit unsigned integer. To make it readable, humans write it as four 8-bit octets separated by dots (Dotted Decimal Notation):
2. What is CIDR Notation?
Historically, the Internet assigned addresses using rigid "Classes" (Class A, B, and C), which led to massive wastage of IPv4 address space. In 1993, Classless Inter-Domain Routing (CIDR) was introduced (RFC 1519).
The number following the slash (e.g. /24) indicates the prefix length: exactly how many leading bits belong to the Network ID, with the remaining bits belonging to individual Hosts.
| CIDR Prefix | Subnet Mask | Total Addresses | Usable Hosts |
|---|---|---|---|
/32 |
255.255.255.255 |
1 | 1 (Single Host / Loopback) |
/28 |
255.255.255.240 |
16 | 14 |
/24 |
255.255.255.0 |
256 | 254 (Standard Home/Office LAN) |
/16 |
255.255.0.0 |
65,536 | 65,534 (Typical Cloud VPC) |
3. Calculating Network and Broadcast Addresses
To find the network boundaries, the computer performs a bitwise AND between the IP address and the subnet mask:
4. RFC 1918 Private IP Ranges
Certain IP address blocks are designated as non-routable on the public Internet, reserved for internal private networks:
10.0.0.0/8(10.0.0.0 – 10.255.255.255): Large enterprises and cloud VPCs (16.7M addresses).172.16.0.0/12(172.16.0.0 – 172.31.255.255): Medium networks, Docker containers (1.04M addresses).192.168.0.0/16(192.168.0.0 – 192.168.255.255): Home routers and small office LANs (65K addresses).
5. Try Our Free Online Subnet Calculator
Calculate netmasks, binary bit visualizers, usable ranges, and CIDR prefixes locally: