Subnet Calculator
Host addresses
254
Broadcast
192.168.1.255
How it works
Subnetting divides a large IP address block into smaller contiguous ranges, isolating network segments for performance, security, and routing efficiency. Every network interface on the internet is assigned an IP address within a subnet, and understanding subnets is fundamental to network design, firewall rule creation, and cloud VPC configuration.
**CIDR notation** Classless Inter-Domain Routing (CIDR) notation expresses a subnet as base-address/prefix-length — e.g., 192.168.1.0/24. The prefix length specifies how many leading bits are fixed (the network portion); the remaining bits identify individual hosts. /24 = 256 addresses (254 usable hosts; .0 is network address, .255 is broadcast). /16 = 65,536 addresses. /32 = one specific host.
**Calculating subnet properties** Subnet mask: set the prefix-length bits to 1, remainder to 0. /24 → 11111111.11111111.11111111.00000000 → 255.255.255.0. Network address: bitwise AND of IP and subnet mask. Broadcast address: bitwise OR of network address and inverted mask. Usable host range: network+1 to broadcast−1. Number of usable hosts: 2^(32-prefix) − 2.
**Subnetting in cloud environments** AWS VPCs require a /16 to /28 CIDR block. Azure VNets support /8 to /29. GCP requires /8 to /29 for subnets. Reserved addresses vary — AWS reserves 5 addresses per subnet (first 4 + broadcast). When designing VPC subnets, plan for future growth by allocating larger CIDR blocks than immediately needed — re-addressing is operationally expensive.
Frequently Asked Questions
- Usable hosts = 2^(32 − prefix_length) − 2. The −2 accounts for the network address (all host bits = 0) and broadcast address (all host bits = 1), which cannot be assigned to hosts. Examples: /24 → 2^8 − 2 = 254 hosts. /25 → 2^7 − 2 = 126 hosts. /30 → 2^2 − 2 = 2 hosts (for point-to-point links). /32 → 0 usable hosts (single host route, used in routing tables not assignments).
- The network address has all host bits set to 0 — it identifies the subnet itself (used in routing tables). Example: 192.168.1.0/24 — .0 is the network address. The broadcast address has all host bits set to 1 — packets sent to it are delivered to all hosts on the subnet. Example: 192.168.1.255/24. Assigning either to a host will cause routing issues; routers drop traffic to these reserved addresses.
- AWS reserves 5 addresses per subnet: .0 (network), .1 (VPC router), .2 (DNS), .3 (future use), .255 (broadcast). So a /24 subnet in AWS has 251 usable hosts, not 254. Azure also reserves 5 addresses but at slightly different positions. GCP reserves 4 addresses. When designing cloud subnets, always check provider-specific reserved address documentation.
- A /30 subnet provides exactly 2 usable host addresses, making it ideal for point-to-point links between two routers. Using a /24 for a router-to-router link wastes 252 addresses. /30s are standard for WAN links and inter-router connections. For IPv6 point-to-point links, /127 is the equivalent (RFC 6164). Some networks even use /31 (2 addresses, no broadcast on P2P links per RFC 3021) to save another bit.