IP Subnet Calculator
Show the math
What Your Result Means
- Network address: The first address in the subnet — it identifies the network itself and cannot be assigned to a host device.
- Broadcast address: The last address in the subnet — packets sent to this address reach every host on the subnet.
- Usable hosts: Total addresses minus the network and broadcast addresses. A /24 gives 254 usable IPs; a /30 gives just 2 (common for point-to-point links).
- Wildcard mask: The bitwise inverse of the subnet mask — used in Cisco ACL and OSPF configurations to define which bits can vary.
- IP class: The traditional classful designation (A, B, C, D, E) based on the first octet. Modern networks use CIDR and largely ignore class boundaries, but it remains useful context.
How This Calculator Works
You enter an IPv4 address and a CIDR prefix length (or dotted-decimal mask). The tool converts the IP to a 32-bit integer, builds a bitmask from the prefix, then performs bitwise AND to get the network address and bitwise OR with the inverted mask to get the broadcast. Host count is 2^(32 − prefix) minus 2 for network and broadcast. It does not handle IPv6 or non-contiguous masks.
Quick Questions
What is a CIDR prefix?
CIDR (Classless Inter-Domain Routing) notation uses a slash followed by the number of leading 1-bits in the subnet mask. For example, /24 means the first 24 bits are the network portion, leaving 8 bits (256 addresses, 254 usable) for hosts.
Why are two addresses always "lost" from the host count?
The first address is reserved as the network identifier and the last as the broadcast address. Neither can be assigned to a device, so usable hosts = 2^(host bits) − 2. The exception is /31 (RFC 3021), where both addresses are usable on point-to-point links.
What is the wildcard mask used for?
The wildcard mask is the inverse of the subnet mask (all 0s become 1s and vice versa). It tells a router which bits to "don't care" about when matching an ACL rule. For example, a /24 subnet mask of 255.255.255.0 has a wildcard of 0.0.0.255.
Does this work with IPv6?
No. This calculator handles IPv4 only. IPv6 addresses are 128 bits with different notation and prefix rules. CIDR concepts still apply, but the math uses a much larger address space.
What about /31 and /32 subnets?
A /31 has only 2 addresses and no broadcast — it is used for point-to-point links per RFC 3021. A /32 is a single host route with exactly one address and zero usable hosts, typically used in routing tables or loopback interfaces.
Sources
- RFC 4632 — CIDR (the IETF standard defining Classless Inter-Domain Routing)
- RFC 3021 — /31 Point-to-Point Links (using 31-bit prefixes on point-to-point links)
- Wikipedia — CIDR (overview of CIDR notation, subnetting, and supernetting)
Method & review
Estimate only. Results reflect your inputs and standard formulas. Double-check important decisions independently.