home/other/ip subnet calculator

IP Subnet Calculator

The IP Subnet Calculator performs subnet calculations for the given network address block, subnet mask, and maximum required hosts per subnet. It determines the network address, usable host range, broadcast address, subnet mask, wildcard mask, binary subnet mask, IP class, CIDR notation, IP type, and more. Both IPv4 and IPv6 are supported.

IPv4 Subnet Calculator

Enter an IPv4 address and select a subnet mask (CIDR prefix) to calculate network address, broadcast address, usable host range, and more. The IP class and IP type describe the address you enter, not the subnet size.

▼Modify the values and click the Calculate button to use

IPv6 Subnet Calculator

Enter an IPv6 address and select a prefix length to calculate the network range, total number of IP addresses, and full expanded address.

▼Modify the values and click the Calculate button to use

Carve a /24 into /30 subnets and half of your 256 addresses vanish: 64 subnets with 2 usable hosts each is 128 usable addresses. Even four /26s leave only 248 instead of 254. These are the numbers this page makes easy to see. Type an address, pick a prefix, press Calculate, and it shows the network and broadcast addresses, the host range, both masks and the count, with a separate IPv6 section further down.

Block Size, Network and Broadcast Math

The page treats the address as one 32-bit integer. Block size = 2^(32 − prefix). Network address = address − (address mod block size). Broadcast = network + block size − 1. For prefixes up to /30, usable hosts = block size − 2, because the first address names the network and the last is the broadcast. The mask equals 2^32 minus the block size, and the wildcard mask is 4,294,967,295 minus the mask.

Typical case, the page default 111.88.17.130 /30. As an integer the address is 111 × 16,777,216 + 88 × 65,536 + 17 × 256 + 130 = 1,868,042,626. The block size is 4 and 1,868,042,626 mod 4 = 2, so the network is 111.88.17.128 and the broadcast is 111.88.17.131. Usable hosts run from .129 to .130, which is 2. The mask is 255.255.255.252, the wildcard is 0.0.0.3 and the hex ID is 0x6F581182. Note that a host address works fine as input; the page masks it down for you.

A prefix that is not on an octet boundary is where hand calculation slips. For 172.16.5.200 /20 the block is 4,096, giving network 172.16.0.0, broadcast 172.16.15.255, 4,094 usable hosts, mask 255.255.240.0 and wildcard 0.0.15.255. That block spans sixteen /24-sized slices (third octet 0 to 15).

Edge case: /31 and /32. For 192.168.1.10 /31 the block is 2, so the range is .10 to .11. Under RFC 3021 a /31 is a point-to-point link where both addresses are usable hosts and there is no network or broadcast address, so the page reports 2 usable hosts, shows the broadcast as N/A and adds a note row saying so. A /32 is a single host: 1 total address, 1 usable, broadcast N/A.

The IP Class and IP Type rows describe the address you typed, not the subnet. The type check covers private ranges, loopback, link-local, shared carrier-grade NAT space (100.64.0.0/10), the three documentation blocks, the benchmarking block, multicast, the reserved 240.0.0.0/4 block and the limited broadcast address. Anything else is called Public. For example 100.64.0.1 reports shared address space and 8.8.8.8 reports Public.

How to Use This Calculator

  1. Leave Network Class on Any unless you want a check. Choosing A, B or C only validates the first octet (1 to 126, 128 to 191 or 192 to 223) and shows an error if it does not fit.
  2. Pick the Subnet from the dropdown. It lists each mask with its prefix, from 128.0.0.0 /1 to 255.255.255.255 /32, and starts at 255.255.255.252 /30.
  3. Type the IP Address in dotted form, for example 192.168.1.0. It must be four numbers from 0 to 255 with no leading zeros or extra characters, otherwise a message explains the format.
  4. Press Calculate. Nothing updates until you do, and Clear returns every field to the defaults.
  5. Read the main Result table, then the second table (binary, integer and hex forms, the in-addr.arpa name, the IPv4-mapped address and the 6to4 prefix), then the table of every network of that size.
  6. For IPv6, use the separate section: choose a prefix from /1 to /128, enter the address and press Calculate.

Frequently Asked Questions

How does the page treat a /31 or a /32?

A /31 shows 2 usable hosts, since RFC 3021 lets both addresses of a point-to-point link be assigned, and a /32 shows 1, a single host. Neither has a broadcast address, so that row and the broadcast column of the network table read N/A. A note row in the result explains each case.

Do I need to set the Network Class?

Almost never. Classes A, B and C are a legacy idea and the maths uses only the prefix you choose. The setting just rejects addresses outside the class.

Why is my 100.64.x.x address not called Public or Private?

Because 100.64.0.0/10 is shared address space reserved for carrier-grade NAT. It is not routable on the open internet and it is not ordinary private space either, so the IP Type row names it separately. The same goes for documentation ranges like 192.0.2.0/24, which are labelled as documentation.

How is the IPv6 section different?

IPv6 has no broadcast address, so the page shows the total address count, 2^(128 − prefix), and the first and last address. The default 2001:db8:85a3::8a2e:370:7334 /64 gives 18,446,744,073,709,551,616 addresses from 2001:db8:85a3:: to 2001:db8:85a3:0:ffff:ffff:ffff:ffff.

Can I type an IPv4-style tail, like ::ffff:192.0.2.1, into the IPv6 box?

Yes. A dotted IPv4 tail in the last 32 bits is converted to two hex groups, so ::ffff:192.0.2.1 is read as ::ffff:c000:201. The IPv6 box rejects more than one ::, groups with non-hex characters, groups longer than four digits and zone names such as %eth0.

Why was my IPv4 address rejected?

The parser is strict. Each of the four parts must be digits only, from 0 to 255, with no leading zeros, because a leading zero is read as octal by some systems. Something like 192.168.1.5x, 192.168.01.1 or 192.168.1 is refused with a message rather than guessed at.