Subnet Calculator
About the Subnet Calculator
The Subnet Calculator takes an IP address and a subnet mask or CIDR prefix and computes the full set of network facts you need to plan or troubleshoot an IP network. From an input like 192.168.1.0/24 it derives the network address, broadcast address, usable host range, total and usable host counts, the wildcard mask, and the dotted-decimal mask. This removes the error-prone binary math of ANDing addresses against masks by hand.
Subnetting works by dividing the 32 bits of an IPv4 address (or 128 bits of IPv6) into a network portion and a host portion. The CIDR prefix, such as /24, states how many leading bits identify the network, leaving the rest for hosts; a /24 leaves 8 host bits, which yields 256 total addresses and 254 usable ones after reserving the network and broadcast addresses. Shortening the prefix to /23 doubles the address space, while lengthening it to /25 halves it.
Network engineers use this to design address plans, size subnets to a department or VLAN, verify that two hosts share a subnet, allocate point-to-point links efficiently with /30 or /31 masks, and check firewall and ACL rules. It is also a quick sanity check when a device cannot reach its gateway because its mask is wrong.
A practical tip: remember that the first address in a subnet is the network identifier and the last is the broadcast, so neither is normally assigned to a host. When you need to think about contiguous blocks rather than a single subnet, the IP Range Calculator is the companion tool, and CIDR aggregation lets you summarize several adjacent subnets into one shorter prefix.
Frequently asked questions
- What is the difference between a subnet mask and a CIDR prefix?
- They describe the same boundary in different notations. A /24 CIDR prefix equals the dotted-decimal mask 255.255.255.0; both say the first 24 bits identify the network.
- Why are there two fewer usable hosts than total addresses?
- The first address in a subnet is reserved as the network identifier and the last as the broadcast address. Neither is assigned to a host, so usable hosts equal total minus two (except on /31 point-to-point links).
- How do I know if two IP addresses are on the same subnet?
- Apply the same mask to both addresses; if the resulting network addresses match, they share a subnet and can communicate directly without a router.
- What does a /30 or /31 subnet give me?
- A /30 provides four addresses with two usable hosts, ideal for a point-to-point link. A /31 is a special two-address block where both addresses are usable, defined by RFC 3021 for links.