TanodTools

Subnet calculator

Work out the network, host range and counts for any IPv4 or IPv6 subnet, then split it into smaller ones.

Runs entirely in your browser

IPv4 and IPv6 only, one subnet at a time. The address type is read from the IANA special-purpose ranges built into the page, so it knows nothing about who owns a public address. Subnet split tables stop at 256 rows.

How to calculate a subnet

  1. Type an address with its prefix length, such as 192.168.1.10/24 or 2001:db8::/32. An IPv4 address with a dotted mask, such as 192.168.1.10 255.255.255.0, works too.
  2. Read the network address, host range and counts. If the address had host bits set, the page tells you which network it was normalised to.
  3. To plan smaller networks, enter a longer prefix under Split into and read the table of subnets.

Subnets and CIDR notation

An IP address has two parts: the leading bits name the network and the remaining bits name the host inside it. The prefix length after the slash says how many leading bits belong to the network, so 192.168.1.10/24 means the first 24 of 32 bits are the network and the last 8 identify one of 256 addresses. Setting every host bit to 0 gives the network address; setting them all to 1 gives the broadcast address, which is why they are normally not handed to devices.

The netmask is the same information written as an address: 24 one-bits followed by 8 zero-bits is 255.255.255.0. Only contiguous masks are valid, so something like 255.0.255.0 is rejected. IPv6 works the same way with 128 bits, but with no broadcast address and a much larger range: a standard /64 LAN subnet holds 264 addresses, about 18 quintillion.

Some ranges mean something special wherever they appear. 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 are private and not routed on the public internet, 100.64.0.0/10 is shared address space for carrier-grade NAT, 169.254.0.0/16 is link-local, and the 192.0.2.0, 198.51.100.0 and 203.0.113.0 blocks are reserved for documentation. The page labels the range your address falls in.

Tips

Questions

Why are there two fewer usable hosts than addresses?

In an ordinary IPv4 subnet the first address names the network and the last is the broadcast address, so neither can be given to a device. A /24 has 256 addresses and 254 usable hosts. Two exceptions exist: a /31 has two addresses and both are usable on a point-to-point link (RFC 3021), and a /32 is a single host.

What does a wildcard mask show?

It is the netmask turned inside out: 0 bits must match and 1 bits are ignored. For 255.255.255.0 the wildcard is 0.0.0.255. Access lists on Cisco equipment and OSPF network statements use this form.

Why is 010.0.0.1 rejected?

A leading zero makes some systems read that part as octal, so 010 would mean 8, while others read it as decimal 10. The same text can point at two different machines, so the page asks you to write the number without the zero.

How does IPv6 differ in a subnet calculation?

IPv6 has no broadcast address, so every address in a prefix can be assigned and the count is simply 2 to the power of (128 minus the prefix). Normal LAN subnets are /64. The page shows the address in the compressed form from RFC 5952 and in full, with all eight 4-digit groups.

What is the compressed form of an IPv6 address?

Leading zeros in each group are dropped, and the longest run of two or more all-zero groups is replaced by ::, taking the leftmost run if two tie. A single zero group is never compressed, so 2001:db8:0:1:1:1:1:1 keeps its 0.

Does this send my addresses anywhere?

No. The arithmetic is done in your browser with big integers, nothing you type is sent anywhere, and it works offline once the page has loaded.