The Evolution from Classful Routing to CIDR
In the early days of the ARPANET and IPv4 internet (1981, RFC 791), network addresses were divided into rigid classes:
This rigid allocation led to massive waste: an organization requiring 300 IP addresses had to be allocated an entire Class B block (65,536 addresses), wasting over 99\% of assigned IPs.
In 1993, the IETF introduced Classless Inter-Domain Routing (CIDR) under RFC 1519, allowing subnet masks of arbitrary bit lengths designated by a slash prefix (e.g., /24, /27, /16).
The Binary Mathematics of IPv4 Addresses
An IPv4 address is not four separate numbers; it is a single 32-bit binary integer divided into four 8-bit octets for human readability:
The Subnet Mask
A subnet mask separates the 32 bits into two distinct functional segments:Subnet Bit Partitioning (/27 Example):
Network Bits (Prefix = 27): Host Bits (32 - 27 = 5):
11111111 . 11111111 . 11111111 . 11100000 ─────> 5 bits for hosts
(255 . 255 . 255 . 224)
Core Subnet Calculations
For any given CIDR block (e.g., 10.0.4.0/24 or 192.168.50.64/27):
1. Number of Total Addresses
/27 network:
2. Number of Usable Host Addresses
In standard IPv4 subnets, two addresses are reserved:0 (identifies the subnet itself).1 (targets all hosts on the subnet).(Note: In AWS/GCP cloud VPCs, 5 addresses per subnet are reserved by cloud hypervisors for router, DNS, and management purposes).
3. Calculating the Network ID via Bitwise AND
Quick Reference: Common Subnet Prefixes
| CIDR Prefix | Subnet Mask | Total IPs | Usable Hosts | Common Use Case |
|---|---|---|---|---|
| /30 | 255.255.255.252 | 4 | 2 | Point-to-point router links |
| /28 | 255.255.255.240 | 16 | 14 | Small microservice clusters |
| /24 | 255.255.255.0 | 256 | 254 | Standard corporate office LAN |
| /20 | 255.255.240.0 | 4,096 | 4,094 | Medium cloud VPC subnets |
| /16 | 255.255.0.0 | 65,536 | 65,534 | Enterprise core network / VPC |
Instant Subnet Calculations with ToolHero
ToolHero's Subnet Calculator computes network IDs, usable IP host ranges, broadcast addresses, wildcard masks, and binary bit breakdowns instantly in your browser without network latency.