RouteDuck

IP addressing

IP Range to CIDR Converter

Paste one range per line, written as start-end. You get the fewest prefixes that cover each range with nothing added and nothing left out.

Write each range as first-last, for example 192.168.1.10-192.168.1.50. Other text on a line is kept as a label.

7 prefixes

192.168.1.10 to 192.168.1.50: 41 addresses
192.168.1.10/31
192.168.1.12/30
192.168.1.16/28
192.168.1.32/28
192.168.1.48/31
192.168.1.50/32
10.0.0.0 to 10.0.255.255 (Branches): 65,536 addresses
10.0.0.0/16

Why one range can need several prefixes

A prefix always starts on a multiple of its own size. A range that starts or ends anywhere else cannot be written as one prefix. 192.168.1.10 to 192.168.1.50 needs six: a /31, a /30, two /28s, another /31 and a /32.

How the list is built

Starting at the first address, the tool takes the largest block that begins there and does not run past the end of the range, then repeats from the next free address. The result is the shortest exact list.

Related tools