Skip to content
gohacks.dev
DevOps

IP Range to CIDR Converter

Convert any IPv4 range, such as 10.0.0.5 to 10.0.1.130, into the smallest list of CIDR blocks that covers it exactly.

Free · No sign-up · Your inputs stay in your browser

Input

Convert an IP range to CIDR blocks

Output

CIDR blocks

382 addresses in 10 blocks

The fewest blocks that cover exactly the range: each step takes the largest block that starts on its own boundary and stays inside the range. Firewalls, security groups and allow lists take CIDR blocks rather than ranges, and a range that does not start on a boundary always needs several.

Runs in this browser. Nothing you paste is sent to a server.

Why ranges become several blocks

A CIDR block always starts at a multiple of its own size, so 10.0.0.5 to 10.0.1.130 cannot be one block: it becomes a /32, a /30, /29, /28, /27, /25 and so on. Firewalls, cloud security groups, Nginx allow lists and most ACLs accept CIDR rather than ranges, and the count matters because security groups limit rules.

Address blocks you are given as ranges

Registry allocations, DHCP pools and some providers' published address lists are written as start and end addresses. Converting them once avoids hand-calculating boundaries. The notation itself is defined in RFC 4632.

Share

Frequently asked questions

How many CIDR blocks can a range need?
Up to about 62 for the worst IPv4 range. Ranges that start and end on round boundaries need just one or two.
Does it handle IPv6 ranges?
This converter is IPv4 only. IPv6 allocations are almost always given as prefixes already.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools