Free tools / DNS and network

IPv4 and IPv6 Subnet Calculator

Enter an address with a prefix or a mask. Get the network, the host range, the masks and, if you ask, the smaller subnets it divides into.

How to read the result

A prefix length such as /24 says how many leading bits of an address name the network. The rest name a host inside it. That notation is CIDR, set out in RFC 4632, and it replaced the old class A, B and C boundaries.

The network address is the first address in the block and names the subnet itself. The broadcast address is the last one and reaches every host on the subnet. Neither is given to a device, which is why a /24 holds 256 addresses and 254 usable hosts.

The subnet mask is the prefix written as four numbers. The wildcard mask is the same mask inverted, and it is what Cisco access lists and OSPF network statements ask for. Typing the wrong one of the two into a firewall rule is a common way to open far more than was intended.

The address type line says whether the address is public, private (RFC 1918), shared carrier space (RFC 6598), loopback, link-local or reserved for documentation. It is worth a look before a range goes into a public DNS record or an allow list.

Splitting a network into subnets

Put a longer prefix in the second box to divide the network. Every extra bit doubles the number of subnets and halves the size of each: a /24 becomes two /25, four /26 or eight /27. The table lists each subnet with its first host, last host and broadcast address, ready to copy into an address plan.

Size subnets for the hosts they will hold a few years from now, and keep servers, users, guests and management interfaces in separate ones. A subnet boundary is where a firewall rule can be placed. A flat network gives an intruder every machine once they have one.

IPv6 works differently

IPv6 has no broadcast address and reserves no host addresses the way IPv4 does. A single LAN is a /64 by convention, because the interface identifier is 64 bits (RFC 4291), so planning is about how many /64 networks a site prefix holds and not about hosts per subnet. For an IPv6 prefix shorter than /64 the result shows that count.

Questions people ask

How many hosts are in a /24 subnet?

A /24 has 256 addresses. The first is the network address and the last is the broadcast address, which leaves 254 for hosts. Each step shorter doubles it: a /23 has 510 usable hosts and a /22 has 1,022.

What is the difference between a subnet mask and a wildcard mask?

They are the same information inverted. For a /24 the subnet mask is 255.255.255.0 and the wildcard mask is 0.0.0.255. Interfaces and most firewalls take the subnet mask. Cisco access lists and OSPF network statements take the wildcard mask.

Why does a /31 show two usable hosts and no broadcast address?

RFC 3021 allows a /31 on a point-to-point link, where there are only two ends and nothing to broadcast to. Both addresses are used for the two routers. A /32 is a single host, which is how a loopback or one allow-list entry is written.

Which IPv4 ranges are private?

RFC 1918 sets aside 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. 100.64.0.0/10 is shared address space for carrier-grade NAT (RFC 6598) and is not private space for your own network. 169.254.0.0/16 is link-local.

Is the address I enter stored?

No. It is used to work out the answer on our server and is not saved or shared. The calculation needs no lookup, so nothing is sent to the network you entered.

Related tools