Subnet arithmetic for IPv4 and IPv6
Enter a CIDR block and read off its network address, netmask, wildcard mask, broadcast, usable range and host count. The same field accepts an IPv4 address with a dotted mask, a bare host address, or an IPv6 prefix. Every mode works on both address families, and IPv6 counts are shown as exact integers rather than rounded floats.
Four modes
Subnet describes one block. For IPv4 the result includes the mask in dotted-decimal and binary, the address class, whether the range is private, loopback, link-local or public, and the reverse DNS zone (0.10.in-addr.arpa. for 10.0.0.0/22). For IPv6 it shows the compressed and expanded forms, the first and last address, how many /64 networks fit inside, and the ip6.arpa. zone.
Split divides a block into equal children. Give it 10.0.0.0/22 and a new prefix of /24 and it lists 10.0.0.0/24 through 10.0.3.0/24, each with its usable range and 254 hosts. Splitting a /48 into /64s produces 65,536 rows, so the list is capped at 4,096 and the footer says how many were left out.
Range to CIDR takes a first and last address and returns the fewest blocks that cover them exactly. The order of the two addresses does not matter.
Contains compares two blocks, or a block and a single address. It reports whether A contains B, whether B contains A, whether they overlap at all, and the shared range when they do. Use it before adding a route or a firewall rule to see whether a new prefix collides with one already in the table.
Example: 10.0.0.0/22
A /22 leaves 10 host bits, so the block holds 2^10 = 1,024 addresses. The netmask is 255.255.252.0 and the wildcard 0.0.3.255. The network address is 10.0.0.0, the broadcast is 10.0.3.255, and the usable range runs from 10.0.0.1 to 10.0.3.254: 1,022 hosts. Split it at /24 and you get four blocks of 254 hosts each, which is the usual way to carve a campus allocation into per-floor networks.
How the mask works
A prefix length counts the leading one bits of the mask. /22 is 22 ones followed by 10 zeros, or 11111111.11111111.11111100.00000000. ANDing an address with the mask zeroes the host bits and leaves the network address; ORing the network with the wildcard sets every host bit and gives the last address in the block. The calculator does this with BigInt, so 128-bit IPv6 values are exact.
/31 and /32
A /30 is the classic point-to-point size with 2 usable hosts, but it wastes half the block on the network and broadcast addresses. RFC 3021 allows /31 on point-to-point links, where both addresses are assigned and there is no broadcast. The calculator reports 2 usable hosts for a /31 and 1 for a /32, and marks the broadcast as not applicable for both.
IPv6 differences
IPv6 has no broadcast address and no address class. The standard assignment to a LAN is a /64, which leaves 64 bits for interface identifiers, so every /64 has the same host capacity whatever the site prefix. The interesting number is usually how many /64s a site receives: a /48 contains 65,536 of them and a /56 contains 256. Counts above 2^53 cannot be represented exactly as a JavaScript number, so they appear as the full integer with a scientific approximation beside it.
Compressed output follows RFC 5952: the longest run of zero groups becomes ::, hex digits are lowercase, and leading zeros in each group are dropped. The expanded form shows all eight four-digit groups for copying into tools that do not accept ::.
Address and mask input
Routers and older configuration files print an address and a dotted-decimal mask on the same line. Paste 192.168.1.77 255.255.255.0 and the mask is converted to /24, then the result shows the network it belongs to, 192.168.1.0/24. A mask whose ones are not contiguous, such as 255.255.0.255, is rejected because it does not describe a CIDR block.
Limits
The Split list stops at 4,096 subnets to keep the page responsive. Range to CIDR handles any span, including the whole IPv6 space, because the output grows with the number of blocks rather than the number of addresses. Scope labels cover the common reserved ranges from RFC 1918, RFC 6598, RFC 4193 and RFC 4291; they are a hint about where an address sits, not a WHOIS lookup, and nothing here queries the network.