IP fundamentals

IPv4 and IPv6 subnet calculation with worked examples

CIDR calculation is arithmetic on fixed network bits. You can determine the address range without querying the internet or discovering devices on the network.

Updated

A /24 example

192.168.1.42/24 fixes the first 24 of the 32 IPv4 bits. The remaining eight bits produce 256 addresses from 192.168.1.0 through 192.168.1.255. The subnet mask is 255.255.255.0. In the usual IPv4 subnet convention, .0 is the network address and .255 the broadcast address, leaving .1 through .254 as the 254 host addresses.

A /27 example

For 192.168.1.42/27, five host bits give 32 addresses. The last octet is grouped in increments of 32; 42 belongs to the 32–63 block. The network is 192.168.1.32/27, mask 255.255.255.224, broadcast 192.168.1.63, and usual usable range .33–.62. This is how the calculator finds boundaries even when the input is a host rather than the network address.

Explore address intervals

Illustrative data · No network requests

192.0.2.37/24256 addresses
192.0.2.0192.0.2.255
Conventional usable hosts192.0.2.1 – 192.0.2.254
24 / 8 · IPv4
/24

Range .0–.255; conventional usable IPv4 hosts .1–.254.

Read all scenarios
  1. /24: 192.0.2.37/24 · 24 / 8 · 256 addresses. Range .0–.255; conventional usable IPv4 hosts .1–.254.
  2. /27: 192.0.2.37/27 · 27 / 5 · 32 addresses. Range .32–.63; conventional usable hosts .33–.62.
  3. /31: 192.0.2.36/31 · 31 / 1 · 2 addresses. On point-to-point links, both .36 and .37 can be used.
  4. IPv6 /64: 2001:db8::/64 · 64 / 64 · 2⁶⁴ addresses. IPv6 has no IPv4-style broadcast address.

Small point-to-point prefixes

A /31 contains two IPv4 addresses. RFC 3021 permits both on point-to-point links, so a calculator should not blindly subtract two. A /32 denotes one address and is not a conventional multi-host subnet. These arithmetic counts do not replace a network operator's assignment policy or cloud provider's reserved addresses.

IPv6 /64 and exact integer arithmetic

2001:db8:1234:1::1/64 fixes the first 64 of 128 bits and leaves 64 address bits. The mathematical total is 18,446,744,073,709,551,616. JavaScript ordinary numbers cannot exactly represent every integer at this scale; InspectMyIP uses BigInt and exports exact decimal strings. The documentation prefix used in this example is not a public target.

Use the result locally

Enter an address with its prefix length, inspect the first and last addresses, and verify the expected mask. This calculation does not scan hosts, check availability, or allocate addresses. You can use private networks and documentation addresses in the browser-only calculator without submitting them to a server.

Calculate a range of your own

Enter an IPv4 or IPv6 prefix to calculate the exact address interval.

Calculated in your browser.

Check your understanding

How many addresses can be used on an IPv4 /31 point-to-point link?

How many addresses can be used on an IPv4 /31 point-to-point link?

Working through a learning path?

Record your own progress on this browser. No account required.

Learning paths →

Try this

Try the examples /24, /27, /31 and /64 in the subnet calculator. Export JSON if you need the exact address count for another tool.

IPv4 / IPv6 subnet calculator →

Technical references