IP Subnet Calculator
Calculate an IPv4 subnet's network address, broadcast address, subnet mask, and usable host range from an address and CIDR prefix.
How It's Calculated
Formula
\text{network} = \text{ip} \;\&\; \text{mask}, \quad \text{broadcast} = \text{network} \;|\; (\sim\text{mask})A subnet mask divides a 32-bit IPv4 address into a network portion and a host portion. The CIDR prefix (e.g. /24) is the number of leading 1-bits in the mask. The network address is the IP address with all host bits set to 0 (a bitwise AND with the mask); the broadcast address is the IP address with all host bits set to 1 (a bitwise OR with the inverted mask, the wildcard mask). Traditionally, the network and broadcast addresses are reserved and not assignable to hosts, so the usable host range is everything strictly between them. Two prefixes need special handling: a /31 subnet has only 2 addresses and, under RFC 3021, both are commonly used as a point-to-point link with no reserved network/broadcast address; a /32 identifies a single host (1 address, a host route) with no host range at all. This calculator reports the traditional usable-host count and range for /0 through /30, and reports 0 traditional usable hosts for /31 and /32, flagging them explicitly rather than silently applying the traditional formula to an edge case it does not fit.
Worked Examples
192.168.1.10 /24
- Mask for /24: 255.255.255.0.
- Network = 192.168.1.10 AND 255.255.255.0 = 192.168.1.0.
- Broadcast = network OR wildcard (0.0.0.255) = 192.168.1.255.
- Usable range: 192.168.1.1 - 192.168.1.254 (254 usable hosts).
10.0.0.5 /30
- Mask for /30: 255.255.255.252 (4 addresses total).
- Network = 10.0.0.4, broadcast = 10.0.0.7.
- Usable range: 10.0.0.5 - 10.0.0.6 (2 usable hosts).
Frequently Asked Questions
Why do /31 and /32 report 0 usable hosts?
The traditional 'usable hosts = total - 2' formula assumes a separate reserved network and broadcast address, which only makes sense when at least 4 addresses exist. A /31 has just 2 addresses (both commonly usable as a point-to-point link per RFC 3021) and a /32 has just 1 address (a single host route), so this calculator reports 0 traditional usable hosts for both rather than a negative or misleading number.
What is a wildcard mask?
The wildcard mask is the bitwise inverse of the subnet mask (used by some routing/ACL configurations). For a /24 (255.255.255.0), the wildcard mask is 0.0.0.255.
Does this calculator support IPv6?
No. This version supports IPv4 CIDR notation only.
What input is rejected as invalid?
Any address that isn't exactly four dot-separated integers from 0 to 255 (including extra/missing octets, negative numbers, or leading zeros), and any CIDR prefix outside the integer range 0-32.