By · Updated

IP Range to CIDR Converter

Fewest CIDR Blocks for an IPv4 or IPv6 Range, Ready for Firewalls

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the IP Range to CIDR Converter works

This IP range to CIDR converter turns a start and end address into the smallest set of CIDR blocks that covers exactly that range. Paste one range per line, for IPv4 or IPv6, and copy the result into a firewall, allowlist or cloud security group that only accepts CIDR notation.

How the IP range to CIDR conversion works

A CIDR block such as 192.0.2.0/24 always starts on a boundary and covers a power of two addresses. Most real ranges do not line up that neatly, so a range like 10.0.0.5 to 10.0.0.60 has to be split into several blocks of different sizes. The converter walks from the start address, takes the largest block that begins there without going past the end, and repeats until the range is covered.

Each line can be a range written with a hyphen, a single address, or an existing CIDR block. Lines starting with a hash are ignored, so you can paste a commented list. The table shows every input with its blocks and address count, and the output box holds one merged list with overlapping and adjacent ranges combined, which is usually what you want to paste into a rule.

IPv6 works the same way with 128-bit addresses. Everything runs in your browser, so internal address plans are never sent anywhere.

FAQ

Why does my range turn into so many blocks?

Blocks must start on a boundary that matches their size. A range that starts or ends in an awkward place needs small blocks at each edge and larger ones in the middle. Widening the range to a round boundary, if that is acceptable, cuts the list down to one or two entries.

Can I paste a list of single addresses?

Yes. Each address becomes a /32 for IPv4 or a /128 for IPv6, and neighbouring addresses are merged into larger blocks in the combined output. That makes it a quick way to shrink a long allowlist before putting it in a firewall.

Is 10.0.0.0/8 the same as the range 10.0.0.0 to 10.255.255.255?

Yes. A /8 fixes the first 8 bits and leaves the other 24 free, which is exactly the 16,777,216 addresses from 10.0.0.0 to 10.255.255.255. Paste either form and the converter gives the same block.

See also: all Data & Code tools, Units, Images, Audio & Video, Documents.

Related tools