How IPv4 Subnetting Works Under the Hood
An IPv4 address consists of 32 binary bits divided into four 8-bit octets separated by decimal points. When a device communicates over a network, it performs a bitwise logical AND operation between its own IP address and its subnet mask to determine whether the destination is local or remote.
By isolating the network prefix from the host identifier, routers can route millions of packets using compact routing tables rather than keeping individual records for every connected device.
The IPv4 Subnetting Mathematical Formulas
1. Usable Hosts Formula
In standard subnets (/0 to /30), two addresses are reserved: all zeros in the host portion represents the Network Address, and all ones represents the Directed Broadcast: Usable Hosts = 2^(32 - Prefix) - 2.
2. Wildcard Mask Calculation
Used in Cisco IOS Access Control Lists (ACLs) and OSPF configurations, the wildcard mask is the exact bitwise inversion of the subnet mask: Wildcard Mask = 255.255.255.255 - Subnet Mask.
Subnetting Edge Cases: RFC 3021 /31 & /32 Host Routes
RFC 3021: Point-to-Point Links with 31-Bit Prefixes (/31)
Historically, network engineers used /30 subnets for point-to-point router links. Because a /30 requires 4 addresses to deliver only 2 usable hosts, 50% of the allocated addresses were wasted. RFC 3021 eliminates this waste by allowing 31-bit prefixes on point-to-point links.
RFC 1122: Single Host Routes (/32)
A /32 prefix has a subnet mask of 255.255.255.255 and defines an exact, single host interface. Routers use /32 routes for loopback interfaces, VPN endpoint termination, and specific security overrides.
Related Networking Calculators & Engineering Tools
IPv6 Subnet Calculator →
128-bit SLAAC prefix lengths, address ranges, and RFC 5952 compression.
CIDR & Subnet Mask Chart →
Searchable /0 to /32 table with wildcard masks and binary bit breakdown.
Cloud VPC CIDR Planner →
AWS, Azure & GCP multi-AZ subnets with cloud reserved IP sizing.
IP Range Calculator →
Calculate start-to-end IP spans and convert ranges into minimal CIDR blocks.
Subnetting Formulas & VLSM →
Step-by-step worked examples, math formulas, and RFC 3021 /31 links.
Home Specialized Subnetting Tools & Deep Dives →
Free online IPv4 and IPv6 subnet calculator. Calculate network addresses, CIDR prefixes, usable host ranges, subnet masks, and broadcast IPs instantly.