Workflow Tools Control Yard

Home / Network

IP range to CIDR converter

Paste a range such as 10.0.0.5-10.0.0.70, a list of blocks, or both. The page gives the fewest CIDR blocks that cover exactly those addresses, merges blocks that overlap or touch, and checks whether an address is in the list. It works for IPv4 and IPv6.

Is an address in the list?

How a range becomes blocks

A CIDR block is an address, a slash and a prefix length: the number of leading bits that every address in the block shares. A /24 holds 256 addresses and a /30 holds 4. Each block holds a power of two, and it starts at a multiple of its size.

So a range that does not start and end on those lines needs more than one block. The converter takes the largest block that starts at the first address and ends inside the range, then does the same from the next address. That gives the fewest blocks that cover the range and nothing more. For 10.0.0.5 - 10.0.0.70 it gives eight:

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/2810.0.0.1610.0.0.3116
10.0.0.32/2710.0.0.3210.0.0.6332
10.0.0.64/3010.0.0.6410.0.0.674
10.0.0.68/3110.0.0.6810.0.0.692
10.0.0.70/3210.0.0.7010.0.0.701

A list is merged the same way: ranges that overlap or touch are joined first, and each joined range is split into blocks. 10.0.0.0/25 and 10.0.0.128/25 become 10.0.0.0/24. RFC 4632 calls this aggregation: a network announces one route for the larger block in place of the smaller ones.

What the list takes

FormExampleRead as
An address192.0.2.7That address alone: 192.0.2.7/32.
A block172.16.0.0/22The block. An address inside it with a prefix, such as 172.16.1.9/22, is read as its block.
An address and a subnet mask10.1.0.0 255.255.255.010.1.0.0/24.
An address and a wildcard mask10.1.0.0 0.0.0.25510.1.0.0/24, as router access lists write it.
A range10.0.0.5 - 10.0.0.70Every address from the first to the last. The dash may have spaces around it, or be the word to.
A short range192.168.1.10-20192.168.1.10 - 192.168.1.20: the number after the dash replaces the last part.
IPv62001:db8::/48, 2001:db8::1-2001:db8::ffBlocks and ranges as for IPv4. IPv6 has no masks.

Some masks read two ways. 10.0.0.1 0.0.0.0 is read as that address alone (a wildcard mask), 0.0.0.0 0.0.0.0 as every address, and 10.0.0.1 255.255.255.255 as that address alone (a subnet mask). The page says so when it meets one.

Sources

More Network tools