Skip to content

IP range to CIDR converter

Turn an IP range like 10.0.0.5 - 10.0.0.20 into the fewest CIDR blocks, or merge a list of blocks into ranges. Works for IPv4 and IPv6.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up

One range, block or address per line: 10.0.0.5 - 10.0.0.20, 192.168.1.10-20, 10.0.0.0/24 or 2001:db8::/48.

Try:

5 CIDR blocks

Covers 16 IPv4 addresses, exactly the addresses entered.

BlockRangeAddresses
10.0.0.5/3210.0.0.51
10.0.0.6/3110.0.0.6 – 10.0.0.72
10.0.0.8/2910.0.0.8 – 10.0.0.158
10.0.0.16/3010.0.0.16 – 10.0.0.194
10.0.0.20/3210.0.0.201

Select a block to see its mask, hosts and bits in the subnet calculator.

As address ranges

The same addresses written as start-end ranges, with overlapping and neighbouring entries merged.

  • 10.0.0.5-10.0.0.20

How it works

Type a range as its first and last address, like 10.0.0.5 - 10.0.0.20 (a dash, an en dash or the word “to” all work), or paste a list of ranges, CIDR blocks and single addresses, one per line or separated by commas. For IPv4, 192.168.1.10-20 is read as 192.168.1.10 to 192.168.1.20.

Entries that overlap or sit next to each other are merged first. Then each range is cut into CIDR blocks from its start: the page takes the largest block that begins at that address and doesn't run past the end of the range, and repeats from the address after it. A block of 2n addresses can only start at a multiple of 2n, so this gives the fewest blocks that cover the range exactly, with no address added or left out.

The result is shown both ways: as CIDR blocks, for firewalls, cloud security groups and routing tables, and as start-end ranges. Copy either list one per line or separated by commas or spaces, or open any block in the subnet calculator to see its mask and hosts.

Questions

How do I convert an IP range to CIDR?

Enter the first and last address with a dash between them, like 10.0.0.5 - 10.0.0.20. The page lists the fewest CIDR blocks that cover exactly that range, here 10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/30 and 10.0.0.20/32.

Why does one range need several CIDR blocks?

A CIDR block always holds a power of two addresses (1, 2, 4, 8 and so on) and starts at a multiple of its size. A range that starts or ends anywhere else can't be one block, so it is covered by a few blocks of different sizes. A range like 192.168.1.0 - 192.168.1.255 fits one block exactly: 192.168.1.0/24.

How do I merge or summarise a list of CIDR blocks?

Paste the blocks, one per line or separated by commas. Overlapping and neighbouring blocks are combined into the fewest blocks that cover the same addresses, so 10.0.0.0/24 and 10.0.1.0/24 become 10.0.0.0/23. Nothing outside the blocks you entered is added.

Does it work with IPv6?

Yes. Enter an IPv6 range like 2001:db8::1 - 2001:db8::ff or IPv6 blocks, and the blocks are written in the short form, such as 2001:db8::/32. IPv4 and IPv6 can be mixed in one list; they are never merged with each other.

Limits

It covers exactly the addresses you enter. It doesn't round a range out to one larger block, and it can't take addresses away from a block (such as 10.0.0.0/8 except 10.1.0.0/16).

A list can hold up to 5,000 ranges and blocks; the tables show the first 256 rows, and the copy buttons copy them all. A block written with host bits set, like 10.0.0.77/24, is read as the block it belongs to (10.0.0.0/24), and the page says so.

The list you enter is kept after the # in the page address, so you can bookmark or share it (very long lists are left out of the link). That part of an address is never sent to a server.

Privacy

This tool runs entirely in your browser. The files you open and what you type are never sent to a server, and nothing is stored after you close the page. See the privacy page.

Related tools