Network and IP Planning · #05

Online IP Range to CIDR Converter

Produces the shortest CIDR list that exactly covers the range between two IP addresses.

  • Data is processed in your browser and not sent to a server

Tool

Start of the range (inclusive)

End of the range (inclusive)

What does this tool do?

An IP block from a provider, a country list or a DHCP pool often comes as 'start–end', while firewall and route definitions need CIDRs. If the range does not fall on prefix boundaries it cannot be written as one CIDR; this tool returns the shortest list that covers it exactly.

How to use it

  1. Enter the first and last address of the same family (IPv4 or IPv6).
  2. Press Calculate and copy the list.

Fields

First address
Start of the range (inclusive)
Last address
End of the range (inclusive)

Worked example

InputValue
First address192.0.2.5
Last address192.0.2.10

Expected result: 6 addresses, 4 CIDRs: 192.0.2.5/32, 192.0.2.6/31, 192.0.2.8/31, 192.0.2.10/32.

.5 alone is not an aligned block (the /31 boundary is .4), so it becomes a /32. .6–.7 and .8–.9 are aligned pairs. .10 is single again. Leaving out one of these lines leaves part of the range uncovered; using a /29 would also allow .0–.4 and .11–.15.

Method and assumptions

From the start address, the algorithm picks the largest block that is aligned to the start and does not pass the end, then continues after that block. The work grows with the number of prefixes, not addresses; ranges up to 2128 are never enumerated.

Using the result and troubleshooting

Use the output as a firewall object, prefix list or allow list. To merge it with existing prefixes, paste everything into the CIDR Aggregator.

Limits and common mistakes

  • Both addresses must be in the same family; IPv4 and IPv6 cannot be mixed.
  • The start cannot be greater than the end.

Frequently asked questions

Why do I get several lines instead of one /24?

Unless the range starts at .0 and ends at .255, a single /24 would cover extra addresses. The tool covers only the addresses inside the range.

Related tools and service

  • CIDR AggregatorReduces a CIDR list to the smallest number of prefixes that cover exactly the same addresses.
  • IPv4 Subnet CalculatorCalculates the network address, broadcast, mask and usable host range of a single IPv4 network.

Related service: VLAN, Routing and Network Segmentation

Network online tools · See all online tools