🎯 IP Range Calculator

Calculate statistics for IP address ranges including total addresses, usable hosts, and network information.

💡 Tip: Enter start and end IP addresses to calculate range statistics.
Enter IP range and click "Calculate Range" to view results.

Counting the range, then carving it into CIDR blocks

Both addresses are flattened to 32-bit integers first. The count is inclusive, so both ends are part of the answer:

value = (o1 << 24) | (o2 << 16) | (o3 << 8) | o4
range size = end value - start value + 1

The block list is built greedily. Starting at the first address, the tool takes the biggest prefix whose block is aligned to its own size and does not run past the end, moves to the address after it, and repeats.

Run 192.168.1.10 to 192.168.1.20: 11 addresses, four blocks - .10/31, .12/30, .16/30 and .20/32. The first is a /31 because .10 is even but not a multiple of 4; .16 cannot take the /28 or /29 it is aligned for without overshooting .20. The sizes 2 + 4 + 4 + 1 come back to 11.

Reading the block list

A range that begins below 128.0.0.0 and ends at or above it is rejected as an invalid order, because of how the two addresses are signed internally. Split it at 127.255.255.255 and run the halves separately.

Frequently asked questions

How many IP addresses are between two addresses?

Subtract the start from the end and add one, because both ends count. 10.0.0.5 to 10.0.0.9 is five addresses, not four.

How do I turn an IP range into CIDR notation?

Split it into aligned power-of-two blocks. Any range can be covered exactly, but only one starting on a boundary with a power-of-two length is a single prefix.

Why does one small range produce several CIDR blocks?

Because a prefix cannot begin partway through a block. Covering 192.168.1.10 to 192.168.1.20 takes a /31, two /30s and a /32 - eleven addresses that no single prefix can express.