Developer tools

IP range to CIDR converter

Turn a first and last IPv4 address into the smallest list of CIDR blocks.

IP range to CIDR converter
Esc to restore

Your inputs

Results update as you type. Larger files run when you press Update result.

Your result

Your result will appear here.

More actions

Your inputs stay in this browser. Nothing is uploaded, and nothing is saved unless you choose “Save result”.

A clear answer. Here’s how.

Starting at the first address, repeatedly takes the largest block that is aligned to its own size and still fits before the last address. The result is the minimal exact cover: the blocks add up to the range with no extra addresses. A range such as 192.168.0.0 to 192.168.1.255 becomes one /23, while an unaligned range needs several blocks.

See a worked example

Worked example

A fixed demonstration, separate from the values you enter above.

First address
10.0.0.5
Last address
10.0.0.20

Example result

Example result
CIDR blockFirst addressLast addressAddresses
10.0.0.5/3210.0.0.510.0.0.51
10.0.0.6/3110.0.0.610.0.0.72
10.0.0.8/2910.0.0.810.0.0.158
10.0.0.16/3010.0.0.1610.0.0.194
10.0.0.20/3210.0.0.2010.0.0.201

5 blocks cover 16 addresses exactly: the smallest CIDR list that spans the range with no extra addresses.