PUBLIC.INTERNET

IPv4 Subnet Calculator

Enter an address such as 10.0.0.5/28 and the page works out the subnet it belongs to: network and broadcast addresses, subnet and wildcard masks, total and usable host counts, first and last usable IP, and the address and mask in binary. A scrolling list shows individual host addresses, up to 256 rows. It treats a /31 as an RFC 3021 point-to-point link with two usable addresses and a /32 as a single host with no broadcast, instead of printing zero or negative counts.

How to calculate an IPv4 subnet

  1. Type an address and prefix into IP Address / CIDR. The field starts with 192.168.1.0/24 and the result is calculated on page load; pressing Enter also runs it.
  2. Click Calculate Subnet. Subnet Summary fills with the network address, broadcast address, subnet mask, wildcard mask, total hosts, usable hosts, and first and last usable IP. Octets must be 0 to 255 and the prefix a whole number from 0 to 32, otherwise an error names the problem.
  3. Compare IP Address (Binary) with Subnet Mask (Binary) in Binary Breakdown to see exactly where the network bits stop.
  4. Scroll Usable Host Range. Subnets with more than 256 usable hosts show only the first 256, and the note under the list gives the full first-to-last range.

Why /31 and /32 break the usual host count

For most prefixes the lowest address is the network ID and the highest is the broadcast, so usable hosts equal 2^(32-N) - 2. A /24 has 254 and a /28 has 14. Applied to a /31, that rule leaves zero hosts, which is why router-to-router links traditionally used a /30 and gave up half of its four addresses. RFC 3021 lets a /31 use both addresses as hosts, because a point-to-point link has no need for a broadcast address.

A /32 is one address, typically a loopback or a host route. This page reports a /31 as 2 usable hosts with broadcast shown as N/A, and a /32 as 1 host. Equipment support for /31 varies, so confirm that your router accepts it before building an addressing plan around it.

The subnet mask is all ones shifted left by 32 minus N bits; its bitwise inverse is the wildcard mask used in access lists and OSPF network statements. The network address is the IP ANDed with the mask, and the broadcast is the network address ORed with the wildcard. The host list is capped at 256 rows so that a /8 does not try to render sixteen million entries in one page.