IP address range calculator
Enter the first and last address of a range, and this tool counts the addresses and lists the smallest set of CIDR blocks that cover it.
Results
Enter your values to see the result.
About this tool
It works with IPv4 and IPv6 addresses, and shows each block with its first and last address and its size. It helps when you turn a range into firewall or routing rules.
- How it is calculated
- the number of addresses = last − first + 1; the range is covered by the fewest CIDR blocks (RFC 4632): from the first address, take the largest block that starts there and does not pass the last address, then continue after it. IPv4 and IPv6 (written the short way of RFC 5952).
- Worked example
- With First address: 192.168.1.10; Last address: 192.168.1.77, the result is: Address type: IPv4; First address: 192.168.1.10; Last address: 192.168.1.77; Addresses in the range: 68; CIDR blocks needed: 7.
- Good to know
- The number of addresses is the last minus the first plus one. To cover the range, the tool repeatedly takes the largest block that starts at the current address and does not go past the end. IPv6 addresses are written in the short form from RFC 5952.
Frequently asked questions
What is a CIDR block?
It is a group of addresses written as an address and a prefix length, such as 192.168.1.0/24. The prefix says how many of the leading bits are fixed.
Why does a range need several blocks?
A block must start at an address that fits its size. A range that does not line up with those boundaries has to be split into smaller blocks.
Does it work with IPv6?
Yes. Enter two IPv6 addresses of the same kind, and the tool counts the addresses and lists the blocks in the same way.