$ traceroute ipv4-subnet-calculator 3 hops · 100% reply
1 ~/home (localhost) 0.1 ms
2 network-ops (10.0.0.1) 0.4 ms
3 ipv4-subnet-calculator (127.0.0.2) 0.2 ms

IPv4 Subnet Calculator

Calculate network address, broadcast, mask, and host count for any IPv4 CIDR.

local DNS · IP · CIDR 0 bytes uploaded
ipv4-subnet-calculator.console TTY · 80×24
◇ man ipv4-subnet-calculator

The Subnet Mistake That Takes Down a Production Service

A network engineer assigns 10.0.1.1 to a server, configures the gateway at 10.0.1.254, and sets the subnet mask to 255.255.255.0 (/24). Everything works. Six months later, a new server at 10.0.2.50 is added to the same VLAN — different third octet, same mask — and suddenly traffic between the two servers routes incorrectly. The engineer entered the address without calculating whether both endpoints actually belong to the same subnet. In a /24, 10.0.1.x and 10.0.2.x are different networks; the gateway is needed for communication between them. Manual subnet math has this failure mode: the calculation looks easy (just check the third octet) until the prefix length is /23, /22, or anything non-obvious, at which point octet-by-octet reasoning breaks down and a calculator becomes essential.

How Subnetting Works: Bits, Not Octets

An IPv4 address is a 32-bit number, conventionally written in dotted-decimal notation (four 8-bit octets). The CIDR prefix length (the number after the slash) specifies how many leading bits constitute the network portion. The remaining bits are the host portion.

For 192.168.10.50/24:

  • Binary: 11000000.10101000.00001010.00110010
  • First 24 bits (network): 11000000.10101000.00001010 = 192.168.10
  • Last 8 bits (host): 00110010 = 50
  • Network address (all host bits = 0): 192.168.10.0
  • Broadcast address (all host bits = 1): 192.168.10.255
  • Usable hosts: 192.168.10.1 through 192.168.10.254 (254 hosts)

For a non-octet-aligned prefix like 172.16.5.60/22, the boundary falls in the middle of the third octet — which is exactly where mental arithmetic fails. The /22 mask in binary is 11111111.11111111.11111100.00000000. ANDing the address with the mask gives the network address; OR-ing with the inverted mask gives broadcast. This tool performs all of those bit operations and presents the human-readable results.

Common Prefix Lengths and Their Uses

  • /32: single host. Used for loopback addresses, BGP neighbor definitions, and static routes to a specific host.
  • /30: 4 addresses, 2 usable. The standard for point-to-point WAN links and router-to-router connections where only two endpoints exist.
  • /29: 8 addresses, 6 usable. Small VLANs for infrastructure subnets (management networks, storage, printers).
  • /28: 16 addresses, 14 usable. Azure default subnet size when provisioning a new virtual network.
  • /24: 256 addresses, 254 usable. The ubiquitous office LAN size; RFC 1918 private space uses these extensively.
  • /22: 1,024 addresses, 1,022 usable. Typical size for a mid-sized enterprise floor or building VLAN.
  • /16: 65,536 addresses. AWS default VPC size; large campus networks.
  • /8: 16,777,216 addresses. The three RFC 1918 private Class A blocks (10.0.0.0/8) are this size.

Cloud Subnet Considerations

Cloud providers reserve more addresses than the standard two (network + broadcast). AWS reserves the first four addresses and the last one in every subnet: network address, VPC router, DNS server, future use, and broadcast. A /28 subnet in AWS gives you 16 − 5 = 11 usable addresses, not 14. Azure reserves the same five in similar fashion. Account for this when planning cloud subnets — a /29 in AWS provides only 3 usable IP addresses for your workloads.

How to Use This Tool

  1. Enter an IPv4 address with CIDR prefix: 10.0.1.0/24, or just a host address with prefix: 192.168.5.37/26.
  2. The tool computes network address, broadcast, subnet mask (dotted decimal and hex), wildcard mask, first and last usable host, and total host count.
  3. Copy any field individually for use in router configs, firewall rules, or documentation.

FAQ

01 Why are usable hosts two fewer than the total address count? +

The network address (all host bits 0) identifies the subnet itself and cannot be assigned to a device. The broadcast address (all host bits 1) is reserved for sending to all hosts simultaneously. Both are consumed in every subnet regardless of size — a /30 with 4 total addresses yields only 2 usable hosts.

02 How do I determine whether two IP addresses are in the same subnet? +

Apply the subnet mask to both addresses using a bitwise AND. If the result is identical, they are in the same subnet. Example: 10.0.1.50 AND 255.255.255.0 = 10.0.1.0; 10.0.1.200 AND 255.255.255.0 = 10.0.1.0. Same result — same subnet. 10.0.2.50 AND 255.255.255.0 = 10.0.2.0 — different network. This tool does the AND operation automatically.

03 What is a wildcard mask and when do I use it? +

A wildcard mask is the bitwise inverse of the subnet mask. Where the subnet mask has 1 (network bits), the wildcard has 0; where the subnet mask has 0 (host bits), the wildcard has 1. Wildcard masks appear in Cisco ACL and OSPF area configurations, where they define which bits to match (0) and which to ignore (1). A /24 subnet mask of 255.255.255.0 has wildcard 0.0.0.255.

04 Why does AWS show fewer usable hosts than a standard subnet calculator? +

AWS reserves five addresses in every subnet: the network address, the VPC router (+1), DNS (+2), future use (+3), and broadcast (last). Standard subnet math reserves only two (network and broadcast). Subtract 3 extra from the standard usable count when planning AWS subnets — a /28 with 14 standard usable hosts provides 11 in AWS.