IPv4 subnet calculator
Enter an IPv4 address with a CIDR prefix or a subnet mask to get its network and broadcast addresses, first and last usable host, host count, wildcard mask and the same figures in binary. It works as you type, in your browser.
Calculate a subnet
Planning public address space? We run our own network, AS208802, and provide IP transit and IPv4 and IPv6 addressing to ISPs and network operators.
How a subnet is calculated
A prefix such as /23 says how many leading bits of the address identify the network; the rest identify hosts. The subnet mask is those network bits written as ones, so /23 is 255.255.254.0.
- Network address: the address with every host bit set to zero (address AND mask).
- Broadcast address: the address with every host bit set to one (network OR wildcard mask).
- Usable hosts: 2 to the power of the host bits, minus the network and broadcast addresses. A /23 has 9 host bits: 512 addresses, 510 usable.
- /31 and /32: a /31 is a point-to-point link where both addresses are hosts and there is no broadcast (RFC 3021); a /32 is a single host.
The calculator also says whether the address is private (RFC 1918), shared carrier-grade NAT space (RFC 6598), or another special-purpose range, and gives its historical class. For every mask from /32 to /0 and the address ranges of each subnet in a /24, see the subnet mask cheat sheet.
Subnet questions
How many usable hosts are in a /24?
A /24 holds 256 addresses. The first is the network address and the last is the broadcast address, which leaves 254 usable hosts.
Why does a /31 have two usable hosts?
A /31 is used for a point-to-point link between two routers. RFC 3021 lets both addresses be used as hosts, because a link with only two ends needs no network or broadcast address.
What is a wildcard mask?
A wildcard mask is the subnet mask with every bit inverted, so 255.255.255.0 becomes 0.0.0.255. Router access lists and OSPF use it to say which bits of an address must match.
Are IP address classes still used?
No. Classful addressing was replaced by CIDR in 1993, so any prefix length can be used with any address. The class is shown for reference only.
Addressing for your network
We run our own dual-stack network and provide IP transit, backhaul and address space to ISPs and network operators.