IPv4 and IPv6 Subnet Calculator: CIDR, Masks and Ranges

Find the exact network block, address count, endpoints and IPv4 subnet mask from an address and prefix. No network lookup.

Leave blank when the address ends in /prefix.

Result

Enter values and select Calculate.

How is this calculated?

A prefix fixes the leading address bits. Clearing the remaining bits gives the block start; setting them gives the end.

Worked example: Find the block containing a documentation address

192.0.2.140/26 uses 26 prefix bits and leaves six bits for addresses. The block is 192.0.2.128/26, ending at 192.0.2.191. It contains 64 addresses; conventional IPv4 host arithmetic leaves 62 after the two boundary addresses.

Method and limits

IPv4 /31 has two endpoints only in point-to-point mode. An IPv4 /32 denotes one address, not a multi-host subnet. IPv6 has no broadcast address; this tool reports its inclusive mathematical range, not an assignable-host count. IPv6 display compresses the longest zero run per RFC 5952. RFC 3021 describes /31 usage. The address is processed locally; no traffic is sent to it.

How to use this calculator

  1. Enter an IPv4 or IPv6 address followed by /prefix. Alternatively, enter the address alone and use the separate input for the prefix length or a contiguous IPv4 dotted mask.
  2. Read the normalized network block, inclusive endpoints and exact count. Change the IPv4 /31 convention only when interpreting that kind of block.

Find the block containing a documentation address

192.0.2.140/26 uses 26 prefix bits and leaves six bits for addresses. The block is 192.0.2.128/26, ending at 192.0.2.191. It contains 64 addresses; conventional IPv4 host arithmetic leaves 62 after the two boundary addresses.

A prefix determines both the size and the alignment

Each extra prefix bit halves the block size. For /26 the IPv4 block contains 2^6 = 64 addresses. The last octet can start at 0, 64, 128 or 192. A last octet of 140 falls into the block starting at 128.

Check the boundary convention separately from the size

198.51.100.10/31 has two mathematical addresses, .10 and .11. The point-to-point selection interprets both as endpoints; it never changes the underlying range. A /32 is one mathematical address and not a shared host range.

Read IPv6 as a range, not a host forecast

The documentation address 2001:db8::23/126 belongs to 2001:db8::20/126 and the last address is 2001:db8::23. IPv6 has no broadcast address. An exact range count does not indicate which addresses are assignable or active.

Frequently asked questions

Why does the displayed block differ from my input?
The block begins with the host bits cleared. The normalized address row retains the address you entered.
Can I enter an IPv4 mask?
Yes; for example, use address 192.0.2.140 and mask 255.255.255.192 in separate inputs. Do not also append /26. Noncontiguous masks are rejected.
Is the last IPv6 address a broadcast address?
No. The last address is the upper bound of the mathematical range, not a broadcast address.
Does this test availability or send traffic?
No. It applies local address arithmetic and does not look up, contact or test any network.

Common mistakes and limits

Sources & methodology

Related calculators