IPv4 Subnet Calculator
CIDR ↔ subnet mask, network/broadcast addresses, usable host range, and wildcard masks with /31 and /32 support.
How IPv4 Subnetting & CIDR Bitmasking Works
In an IPv4 network, a 32-bit address is split into two logical segments: the Network ID, which identifies the routing domain across routers, and the Host ID, which uniquely identifies an endpoint interface within that broadcast domain. Classless Inter-Domain Routing (CIDR) replaces rigid legacy classes (A, B, C) with flexible prefix lengths represented in slash notation (e.g., /24).
When a subnet mask such as 255.255.255.0 is applied, routers perform a bitwise AND operation between the destination IP address and the subnet mask to determine whether traffic is local or must be forwarded across a gateway. For example, 192.168.1.135 AND 255.255.255.0 = 192.168.1.0.
RFC 1918 Private Ranges
- 10.0.0.0/8 (10.0.0.0 – 10.255.255.255)
- 172.16.0.0/12 (172.16.0.0 – 172.31.255.255)
- 192.168.0.0/16 (192.168.0.0 – 192.168.255.255)
Special-Use IP Blocks
- 100.64.0.0/10 — Carrier-Grade NAT (RFC 6598)
- 169.254.0.0/16 — Link-Local APIPA (RFC 3927)
- 127.0.0.0/8 — Loopback & Inter-process
Related Network Utilities
Frequently Asked Questions
What is a /31 subnet and why does RFC 3021 allow 2 usable hosts without a broadcast address?
Under standard IPv4 subnetting (RFC 950), every subnet reserves two addresses: the first as the network identifier and the last as the directed broadcast address. In small point-to-point links (/30), this wastes 50% of the addresses (only 2 out of 4 are usable). RFC 3021 solves this for point-to-point router links by eliminating the directed broadcast address on /31 subnets, making both addresses (e.g., .0 and .1) fully usable host interfaces.
How do I determine the usable host count for any CIDR prefix?
For standard subnets (/0 to /30), the total host capacity is 2^(32 - CIDR), and usable hosts are calculated as 2^(32 - CIDR) - 2. For example, a /24 network has 32 - 24 = 8 host bits, yielding 2^8 = 256 total addresses and 254 usable hosts. For /31 subnets, usable hosts equal 2 (RFC 3021), and for /32 host routes, usable hosts equal 1.
What is the difference between a subnet mask and a wildcard mask?
A subnet mask uses contiguous binary 1s to identify the network portion and 0s for the host portion (e.g., 255.255.255.0). A wildcard mask is the exact bitwise inverse (computed as 255.255.255.255 minus the subnet mask = 0.0.0.255), where 0s represent "must match" bits and 1s represent "ignore" bits in Cisco Access Control Lists (ACLs) and OSPF route configurations.
Need this designed for a real production environment?
Consult with Gurinder Singh and vetted cloud specialists for Azure Landing Zones, AWS VPC peering, and hybrid connectivity.