IP Range to CIDR Converter |
| CIDR Block | IP Count |
|---|
IP Range to CIDR Converter — Convert Any Address Range to CIDR Notation
IP range to CIDR conversion computes the minimal set of CIDR blocks (RFC 4632) that exactly cover a start-to-end IPv4 or IPv6 address range. The algorithm selects the largest power-of-2 block aligned to a binary boundary at the current address, records it, advances past that block, and repeats until the entire range is covered. A range spanning a non-power-of-2 address count or starting at a non-boundary address produces multiple CIDR blocks — each covering a precisely aligned portion of the full range.
| Property | Detail |
|---|---|
| Protocol Standard | RFC 4632 — Classless Inter-Domain Routing (CIDR) |
| Input | Start IP + End IP — IPv4 or IPv6, same version required |
| Algorithm | Greedy binary-alignment: largest power-of-2 block per step |
| Typical Output | 1 block (aligned range) — up to 32 blocks (IPv4 worst case) |
| IPv4 Block Sizes | /0 (4,294,967,296 addresses) to /32 (1 address) |
| IPv6 Block Sizes | /0 (2¹²⁸ addresses) to /128 (1 address) |
| Calculation | Client-side JavaScript — no server round-trip, no data stored |
What the Results Mean
| Column | Meaning | Example |
|---|---|---|
| CIDR Block | An IP address combined with a prefix length (the /N suffix), defining the network. The prefix length determines how many leading bits are fixed — the remaining bits identify individual hosts within the block. | 192.168.1.0/24 |
| IP Count | Total IP addresses in this block — 2^(32−N) for IPv4, 2^(128−N) for IPv6. Summing all rows must equal (end IP − start IP + 1). | 256 |
How IP Range to CIDR Conversion Works
The conversion implements the greedy CIDR aggregation algorithm described in RFC 4632 (Classless Inter-Domain Routing — CIDR: The Internet Address Assignment and Aggregation Plan, September 2006). Starting at the first IP address — represented as a 32-bit integer for IPv4 or a 128-bit integer for IPv6 — the algorithm finds the maximum bit offset n such that: (1) the current address is evenly divisible by 2n (binary boundary alignment), and (2) the block of 2n addresses does not extend past the end address. The current address and prefix length (32−n for IPv4, 128−n for IPv6) form the next CIDR entry. The current address advances by 2n and the loop repeats until the current address exceeds the end address.
Binary boundary alignment is why arbitrary ranges produce multiple blocks. A /24 block (256 addresses) must start at an address where the last octet is 0. A /25 block (128 addresses) must start where the last octet is 0 or 128. A range starting at 10.0.0.1 cannot begin with any block larger than /32 at that address, because 1 is not divisible by any power of 2 greater than 1. The algorithm handles this by starting with the smallest valid block at the non-aligned start, then progressively selecting larger blocks as the current address advances to aligned positions.
The tool accepts IPv4 ranges up to the full /0 block (4,294,967,296 addresses) and IPv6 ranges up to /0 (2128 addresses). Input validation rejects mixed-version pairs (e.g. an IPv4 start with an IPv6 end) and ranges where the start IP is greater than the end IP.
IP Range to CIDR Converter
Convert a start and end IP address into the minimal set of CIDR blocks for any IPv4 or IPv6 range.
Enter the End IP Address
Click Generate CIDR Blocks
Review the CIDR Block Table
Common Uses for IP Range to CIDR Conversion
Firewall rule generation. A network security engineer must block traffic originating from a provider's published IP range — for example, 203.0.113.0 to 203.0.114.255. Entering this range produces two /24 CIDR blocks (203.0.113.0/24 and 203.0.114.0/24), ready to paste directly into iptables, pfSense, or an AWS Security Group ingress rule without manual calculation or risk of off-by-one errors.
Cloud infrastructure access control. A DevOps engineer configuring an Azure Network Security Group must allow access from a vendor's IP allocation. Vendors commonly publish their ranges as start–end pairs in documentation or security advisories. Converting those pairs to CIDR notation produces the exact format required by cloud provider access-control APIs, which accept only CIDR input.
Routing table aggregation. A network administrator consolidating BGP routing tables receives legacy route entries documented as start/end pairs from a decommissioned system. Converting each pair to CIDR blocks produces the compact notation needed to configure BGP peers, reduce the number of route advertisements (route summarization per RFC 4632), and minimize router memory consumption.