IPv4 Subnet Mask & CIDR Calculator
Calculate network addresses, broadcast boundaries, usable IP host ranges, Cisco wildcard masks, and 32-bit binary octet allocations. 100% private and client-side.
32-Bit Binary Address Allocation
Infrastructure & Security Suite: Generating secure pre-shared keys, router admin passwords, or SSH passphrases? Create hardware-random credentials with our CSPRNG Password Generator. To audit router running-config files or compare firewall ACL revisions, use our Text Diff Checker & Code Comparison Suite.
How IPv4 Subnetting Works: The Bitwise AND Operation
An Internet Protocol Version 4 (IPv4) address consists of exactly 32 binary bits partitioned into four 8-bit octets separated by dots. A router determines whether a destination IP resides on the local layer-2 broadcast domain or requires forwarding through a default gateway by executing a hardware-level Bitwise AND operation between the destination IP and the subnet mask:
IP Address (Host): 192.168.1.130 → 11000000.10101000.00000001.10000010Subnet Mask (/24): 255.255.255.0 → 11111111.11111111.11111111.00000000-----------------------------------------------------------------------------------Network Address: 192.168.1.0 → 11000000.10101000.00000001.00000000 (Bitwise AND)Broadcast Address: 192.168.1.255 → 11000000.10101000.00000001.11111111 (Host Bits = 1)
Because the first address in any standard block (all host bits set to 0) is reserved as the Network ID, and the final address (all host bits set to 1) is reserved for the Broadcast Address, the usable host capacity is calculated as:
Usable Host Capacity = 2^(32 - CIDR Prefix) - 2
Variable Length Subnet Masking (VLSM) Hierarchical Design
In enterprise network engineering, Variable Length Subnet Masking (VLSM) (RFC 1878) replaced rigid classful boundaries by allowing engineers to partition a single parent block into subnets of varying prefix lengths matched to host requirements:
| Department / Tier | Required Host Capacity | Assigned CIDR Prefix | Allocated Subnet Mask | Address Efficiency |
|---|---|---|---|---|
| Campus Wi-Fi Users | 100 Hosts | /25 | 255.255.255.128 | 126 Usable IPs (26 spare) |
| Engineering Workstations | 50 Hosts | /26 | 255.255.255.192 | 62 Usable IPs (12 spare) |
| Server DMZ Management | 12 Hosts | /28 | 255.255.255.240 | 14 Usable IPs (2 spare) |
| Router Point-to-Point | 2 Hosts | /30 or /31 | 255.255.255.252 | Zero address waste |
Cloud VPC Subnet Constraints: The 5-IP Reservation Rule
When designing subnets for cloud environments (such as Amazon Web Services VPC or Microsoft Azure VNet), cloud hypervisors do not follow traditional on-premises address availability. In AWS VPC, 5 IP addresses are reserved in every subnet and cannot be assigned to instances:
x.x.x.0: Network address.x.x.x.1: Reserved by AWS for the default VPC router gateway.x.x.x.2: Reserved by AWS for the internal DNS resolver server.x.x.x.3: Reserved by AWS for future functionality.x.x.x.255: Network broadcast address (AWS does not support standard broadcast, but reserves the address).
Consequently, a standard /24 subnet in AWS provides 251 usable IP addresses rather than the standard on-premises 254.
RFC 1918 Private IP Address Spaces
The Internet Engineering Task Force (IETF) reserved three dedicated IPv4 blocks for private corporate networks and home local area networks (LANs). These packets are non-routable across the public Internet:
| RFC 1918 Block | CIDR Prefix Range | Total IP Addresses | Classful Equivalent & Deployment Scope |
|---|---|---|---|
| 10.0.0.0/8 | 10.0.0.0 – 10.255.255.255 | 16,777,216 | Class A • Enterprise data centers, Fortune 500 corporate intranets. |
| 172.16.0.0/12 | 172.16.0.0 – 172.31.255.255 | 1,048,576 | Class B • Cloud VPCs (AWS Virtual Private Cloud, Microsoft Azure). |
| 192.168.0.0/16 | 192.168.0.0 – 192.168.255.255 | 65,536 | Class C • Consumer Wi-Fi routers, home networks, small branch offices. |
Universal CIDR Subnet Mask Reference Table
Quick lookup cheat sheet across standard prefix lengths:
| CIDR Prefix | Subnet Mask | Cisco Wildcard Mask | Total Addresses | Usable Hosts |
|---|---|---|---|---|
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 (Traditional Point-to-Point) |
| /31 | 255.255.255.254 | 0.0.0.1 | 2 | 2 (RFC 3021 Point-to-Point) |
| /32 | 255.255.255.255 | 0.0.0.0 | 1 | 1 (Single Host / Loopback Route) |
To convert between data transfer metrics, optical network speeds, and byte storage, convert values with our Scientific Notation Calculator.