From IP Range to CIDR: Building the Minimal Block List
November 19, 2026 · DevTools
Firewalls, ACLs, DNS allowlists, and provisioning systems all speak CIDR — but the data you start from is usually a range: "everything from 10.0.0.5 to 10.0.0.14". The IPv4 Range Expander converts any inclusive start/end pair into the smallest list of CIDR blocks that covers it exactly, using the greedy greatest-common-prefix split: each step takes the largest block the alignment of the cursor allows that still fits the remaining range, which is provably minimal.
Aligned ranges collapse to one block
A range that already sits on a power-of-two boundary compresses perfectly: 192.168.1.0 – 192.168.1.255 expands to exactly 192.168.1.0/24 — 256 addresses, 254 usable hosts, no warning. At the extreme, 0.0.0.0 – 255.255.255.255 returns the single block 0.0.0.0/0 with the full 32-bit address count and usable-host totals computed without overflow, because the arithmetic is done in 32-bit unsigned space rather than floating point.
Unaligned ranges split honestly
10.0.0.5 – 10.0.0.14 doesn't sit on any single CIDR boundary, so the tool expands it into the five minimal blocks:
10.0.0.5/32
10.0.0.6/31
10.0.0.8/30
10.0.0.12/31
10.0.0.14/32
— and shows an explicit warning that the range is not CIDR-aligned. That warning is the useful part: it tells you the expansion is correct and that the range itself was probably hand-drawn, which is worth knowing before it goes into a firewall rule. Each block ships with its network address, prefix, usable host range, and counts — RFC 3021 point-to-point links keep both addresses of a /31, and a /32 keeps its single one — plus range totals for addresses and usable hosts.
When you need this
- Writing an allowlist entry when the vendor gave you a range, not a block.
- Verifying that a "just give us /24" request actually corresponds to the range in the ticket.
- Converting DHCP scope boundaries into the CIDR notation your router expects.
Local arithmetic, no lookups
Everything computes on your device — no BigInt, no server, no registry lookups. Addresses and ranges are just 32-bit unsigned integers here, and the expansion algorithm is pure arithmetic, which is why the whole thing runs instantly for any range up to the entire address space.
For the neighboring jobs: single-block subnet math (masks, host counts, ranges from one prefix) lives in the Subnet Calculator, and compressing the IPv6 side of the house is the IPv6 Address Expander's specialty.