IP Range to CIDR Converter - Aggregate IP Addresses
Calculations performed locally
Convert any start-to-end IP range into optimal CIDR notation. Get the minimum number of CIDR blocks with efficiency metrics for firewalls, routing tables, and network configuration.
Generate CIDR Blocks from IP Address Ranges
Enter an IP range above to get started
We'll calculate the optimal CIDR blocks for your range
Convert IP Ranges to Optimal CIDR Blocks
IP to CIDR converts any start-to-end IP address range into the mathematically minimal set of CIDR blocks. Enter your IP range, and we calculate the optimal CIDR notation using the summarize_address_range algorithm—perfect for firewall rules, route aggregation, and network documentation.
What You'll Discover
Can Find
- Optimal set of CIDR blocks covering the range
- Number of CIDR blocks required
- Efficiency percentage (how well CIDRs fit)
- Each block's prefix length and IP count
- IP range boundaries per block
- Network classification (Private/Public/Reserved)
Cannot Find
- Individual IP enumeration (use CIDR to IP Range)
- Subnet masks in binary or hex format
- VLSM subnet splitting calculations
- IP geolocation or ISP details
- Binary breakdown of addresses
How to Convert IP Range to CIDR
Aggregate any IP range in 3 simple steps
Enter Start IP
Type or paste the first IP address in your range (e.g., 192.168.1.0 for IPv4 or 2001:db8::1 for IPv6).
Enter End IP
Enter the last IP address in your range. Both IPs must be the same version—you cannot mix IPv4 and IPv6.
Get CIDR Blocks
Click Convert to see the optimal CIDR notation. Copy individual blocks or export all results as JSON, CSV, or text.
Understanding Your IP to CIDR Results
We display 6 key fields. Here's what each means:
CIDR Notation
The network/prefix format covering part of your IP range. Each CIDR block represents the largest possible subnet that fits within your range at that point. For example, 192.168.1.0/25 covers exactly 128 addresses starting at 192.168.1.0.
192.168.1.0/25
IP Range
The first to last IP address within this specific CIDR block. Combined, all block ranges should exactly cover your original input range. This shows you exactly which IPs each CIDR block includes.
192.168.1.0 – 192.168.1.127
Prefix Length
The /X suffix indicating network size. Smaller prefix = larger block (/24 = 256 IPs, /25 = 128 IPs). This determines how many addresses are covered by each CIDR block using the formula 2^(32-prefix) for IPv4.
/25 = 128 IPs
Address Count
Total IP addresses in this specific CIDR block. The sum of all block counts should match the total number of IPs in your original range. Useful for verifying complete coverage.
128
Efficiency %
How well the CIDR blocks match your requested range. 100% means perfect binary alignment—CIDRs cover exactly your IPs. Lower percentages indicate some extra IPs are included due to binary boundary constraints.
99.24%
Classification
Network type based on the starting IP address. Shows whether your range falls within Private (10.x, 172.16-31.x, 192.168.x), Public (globally routable), Reserved (IANA special-use), or Multicast (224-239.x) address space.
Private
Why Use Our IP to CIDR Converter
More than basic CIDR calculators
Optimal Aggregation
Uses the summarize_address_range algorithm to calculate the mathematically minimum number of CIDR blocks needed to cover your exact IP range.
Efficiency Metrics
Unique feature showing how well CIDR blocks fit your range as a percentage—helpful for understanding binary boundary alignment and network planning.
IPv4 & IPv6 Support
Full dual-stack support for any valid IP address format. Enter IPv4 or IPv6 ranges with the same interface and algorithm.
Triple Export Formats
Download CIDR blocks as JSON for APIs and automation scripts, CSV for Excel and Google Sheets, or TXT for documentation.
One-Click Copy
Copy individual CIDR blocks with a click or grab all blocks at once. Perfect for pasting into firewall rules, router configs, or security groups.
IP Classification
Instantly see if your range is Private, Public, Reserved, or Multicast—essential for understanding routing and security implications.
When You Need IP to CIDR Conversion
Common scenarios for IP range aggregation
Firewall Rule Consolidation
Convert long lists of individual IP addresses into compact CIDR notation. Fewer rules mean better firewall performance and easier maintenance.
Route Summarization
Aggregate IP ranges into CIDR blocks for routing table optimization. Reduces router memory usage and improves convergence time.
Cloud Security Groups
Generate CIDR blocks for AWS Security Groups, Azure NSGs, or GCP Firewall rules from your IP allocations or vendor-provided ranges.
Network Documentation
Convert legacy IP range documentation (192.168.1.0 - 192.168.1.255) into modern CIDR notation (192.168.1.0/24) for network diagrams and technical specs.
How IP to CIDR Conversion Works
We use RFC-compliant algorithms to find optimal CIDR aggregation.
Summarization Algorithm
Our converter uses Python's summarize_address_range() function for RFC-compliant network calculations. The algorithm finds the largest possible CIDR block starting at the current IP address, adds it to the result set, then advances to the next IP after that block and repeats until the entire range is covered. This guarantees the mathematically minimum number of CIDR blocks.
CIDR Binary Boundaries
CIDR blocks must start on binary boundaries. A /24 must start at an address divisible by 256, a /25 at an address divisible by 128, and so on. When your IP range doesn't align to these boundaries—for example, 192.168.1.0 to 192.168.1.130 (131 IPs)—multiple CIDR blocks are required because 131 isn't a power of 2.
Efficiency Calculation
Efficiency percentage = (IPs in your range ÷ IPs covered by all CIDRs) × 100. A score of 100% means perfect binary alignment—the CIDR blocks cover exactly your requested IPs with no extras. Scores below 100% indicate that binary boundary constraints force inclusion of some additional IP addresses.
IPv4 vs IPv6 Handling
Both IP versions use the same summarization algorithm with different address lengths. IPv4 uses 32-bit addresses (prefix /0 to /32), while IPv6 uses 128-bit addresses (prefix /0 to /128). The binary boundary rules apply identically—the only difference is the address space size.
Tool Specifications
- IPv4 Prefix Range
- /0 to /32
- IPv6 Prefix Range
- /0 to /128
- Max IP List (API)
- 1,000 IPs
- Export Formats
- JSON, CSV, TXT
- Cache Duration
- 24 hours
- API Access
- Free, no key required
- Rate Limit
- None
- Algorithm
- summarize_address_range
Frequently Asked Questions
How do I convert an IP range to CIDR?
Enter the first IP (start) and last IP (end) of your range into the two input fields, then click Convert. We calculate the optimal set of CIDR blocks that exactly cover your range using the summarize_address_range algorithm.
Why do I get multiple CIDR blocks for one IP range?
CIDR blocks must follow binary boundaries. If your range doesn't align—for example, 192.168.1.0 to 192.168.1.130 (131 IPs)—it must be expressed as multiple blocks because 131 isn't a power of 2. The algorithm finds the minimum number of blocks needed.
What does the efficiency percentage mean?
Efficiency shows how closely the CIDR blocks match your requested range. 100% means perfect boundary alignment—CIDRs cover exactly your IPs. Lower percentages mean some extra IPs are included due to binary boundary constraints that can't be avoided.
Can I convert a list of individual IPs to CIDR?
The web interface uses start/end ranges. For non-consecutive IP lists, use our API with the ip_list parameter, which accepts up to 1,000 individual IP addresses and finds the optimal CIDR blocks to cover them.
Does this tool support IPv6?
Yes! Enter IPv6 addresses in standard notation (e.g., 2001:db8::1 to 2001:db8::ff). Both start and end must be the same IP version—you cannot mix IPv4 and IPv6 in a single conversion.
What's the difference between IP to CIDR and CIDR to IP Range?
They're inverse operations. IP to CIDR aggregates a range of IP addresses into compact CIDR notation. CIDR to IP Range does the opposite—it expands a CIDR block to list every individual IP address. Use IP to CIDR for consolidation, CIDR to IP Range for enumeration.
Can I use the results in my firewall?
Absolutely! CIDR notation is the standard format accepted by all major firewalls, routers, cloud security groups (AWS, Azure, GCP), and access control lists. Our output is ready to paste directly into your configurations.
Why doesn't my range fit into a single CIDR block?
Your range likely crosses binary boundaries or contains a non-power-of-2 number of addresses. For example, 192.168.1.0 to 192.168.1.130 spans 131 IPs, but CIDR blocks can only contain 1, 2, 4, 8, 16, 32, 64, 128, 256... addresses. Multiple blocks are needed to cover odd-sized ranges.
Ready to Convert Your IP Range?
Enter any start-to-end IP range above to get optimal CIDR blocks instantly.
Try It Now