IP Range to CIDR Calculator
Enter a starting and ending IPv4 address to find the smallest set of CIDR blocks that exactly covers the range.
Tip: You can paste any valid IPv4 range, such as 10.0.0.10 to 10.0.1.200.
What does “calculate CIDR from IP range” mean?
When people ask how to calculate CIDR from an IP range, they usually want to convert a start address and end address into one or more CIDR blocks. CIDR (Classless Inter-Domain Routing) is the modern way to describe networks, like 192.168.1.0/24.
Sometimes your range lines up perfectly with one subnet. Other times it does not, and you need multiple blocks to represent the same addresses without missing any and without including extras.
Why this conversion matters
- Firewall rules: Many firewalls accept CIDR notation, not raw start/end ranges.
- Cloud security groups: AWS, Azure, and GCP often use CIDR for allowlists and route tables.
- Routing policies: CIDR helps summarize routes efficiently.
- Access control: CIDR blocks are easier to audit than long lists of individual IPs.
How the calculator works
This tool takes your start and end IPv4 addresses and applies a standard subnetting approach:
- Validate and convert each dotted IP into a 32-bit number.
- At the current start point, find the largest aligned network block.
- Shrink that block if it would pass the range end.
- Add the block and continue until the entire range is covered.
The result is the minimum number of CIDR blocks that exactly represent your range.
Quick example
Input range
192.168.1.0 to 192.168.1.255
Output
192.168.1.0/24
Because this range starts on a /24 boundary and contains exactly 256 addresses, it compresses into one block.
When you get multiple CIDR blocks
If the range starts or ends in the middle of a subnet, it cannot always be represented by a single CIDR. For example, a range like 10.0.0.10 to 10.0.0.25 is usually split into several blocks such as /31, /30, /29, and /32 combinations.
That is normal and expected. The goal is exact coverage with no overlap errors.
Common mistakes to avoid
- Using invalid octets: Each octet must be 0–255.
- Reversed ranges: If start is greater than end, swap them.
- Assuming one CIDR always exists: Many ranges require multiple entries.
- Forgetting broadcast/network boundaries: Alignment determines valid block sizes.
CIDR and subnet mask relationship
The prefix length in CIDR maps directly to a subnet mask:
/24=255.255.255.0/16=255.255.0.0/32= single IP/0= entire IPv4 space
In the calculator output, each CIDR line includes the equivalent mask and first/last IP so you can validate results quickly.
Frequently asked questions
Does this calculator support IPv6?
This page handles IPv4 only. IPv6 range-to-CIDR conversion follows similar ideas but uses 128-bit addressing.
Is the output optimized?
Yes. The algorithm returns the smallest set of CIDR blocks needed to exactly cover the requested range.
Can I use this for ACL allowlists?
Absolutely. This is one of the most common uses, especially for router ACLs, WAF rules, and cloud network controls.
Final thoughts
Knowing how to calculate CIDR from an IP range is a core networking skill. It saves time, reduces configuration mistakes, and keeps security rules tidy. Use the calculator above whenever you need fast and accurate IP range conversion.