IP Range to CIDR Converter

Enter the first and last address. You get the smallest set of CIDR blocks that covers the range exactly.

CIDR blocks

A range rarely fits one CIDR block. Blocks must start on a boundary that matches their size, so the converter repeatedly takes the largest aligned block that still fits, which gives the fewest blocks. Ranges that begin and end on block boundaries, such as 10.0.0.0 to 10.0.255.255, collapse to a single block.

Use the result

Paste the blocks into the allow a port from specific IPs tool to build firewall rules.

Related: CIDR to IP range | IP range to CIDR | Does a CIDR contain an IP? | Split a subnet

FAQ

How do I convert an IP range to CIDR?

Take the largest block that starts at the current address, stays aligned to its size and does not pass the end address, then continue after it until the range is covered.

Why does my range need several CIDR blocks?

A CIDR block always begins on a multiple of its size. A range that starts or ends off those boundaries has to be split into several blocks.

Is the result the smallest possible list?

Yes, for a contiguous range this greedy method produces the minimum number of CIDR blocks.

© PacketUtils. Tools run in your browser. Review every command before using it in production.HomeAboutContactPrivacy Policy