---
title: "IP Range to CIDR Converter for IPv4 and IPv6 | CanDoYa"
description: "Convert an IPv4 or IPv6 range to the smallest exact CIDR list, or expand a CIDR block to its first and last address. Free and private."
url: https://candoya.com/tools/cidr-range-calculator/
locale: en
type: browser-tool
---

# IP Range to CIDR Converter

Category: Developer

## What does an IP range to CIDR converter do?

An IP range to CIDR converter turns inclusive start and end addresses into the smallest set of aligned CIDR blocks that covers the range exactly. It also expands IPv4 or IPv6 CIDR notation into its normalized first address, last address, and total address count, all inside your browser.

CIDR blocks must start on binary boundaries and contain a power-of-two number of addresses. This calculator uses exact integer arithmetic for both 32-bit IPv4 and 128-bit IPv6. It never enumerates individual addresses, so even very large ranges are converted quickly without uploading your network plan.

## How to use it

1. **Enter both endpoints** - Type the inclusive start and end IPv4 or IPv6 addresses in the Range to CIDR mode.
2. **Review the minimal block list** - The result updates with the fewest aligned CIDR blocks that cover every address and nothing outside the range.
3. **Copy the CIDRs** - Copy the newline-separated list for a firewall, route table, cloud policy, or configuration file.
4. **Reverse the calculation** - Switch to CIDR to range to normalize one prefix and see its exact first address, last address, and count.

## Who it's for

- **Security engineers** converting provider IP spans into exact firewall, allowlist, and access-control entries.
- **Cloud and DevOps teams** preparing compact CIDR lists for security groups, Terraform, and routing policy.
- **Network administrators** checking whether a quoted start-to-end range aligns to one prefix or needs several blocks.
- **Developers** expanding IPv4 or IPv6 CIDRs while testing parsers, validators, and IP address management code.

## Expert note

The greedy conversion is minimal because each step chooses the largest power-of-two block that is aligned at the current address and does not cross the ending address. An off-boundary span such as 192.168.1.5 through 192.168.1.130 therefore needs several blocks, while 192.168.1.0 through 192.168.1.255 collapses to one /24.

## Frequently asked questions

### Are my IP addresses or network ranges uploaded?

No. IPv4 and IPv6 parsing, block alignment, and range conversion happen locally in your browser. This tool does not send your addresses to a calculation API or save the network plan you enter.

### Is the IP range to CIDR converter free?

Yes. You can convert ranges and CIDR blocks without an account, payment, download, or calculation limit. The converter uses built-in browser arithmetic and does not depend on a paid network service.

### What range sizes does the calculator support?

It supports the full IPv4 space from 0.0.0.0/0 and the full 128-bit IPv6 space from ::/0. Address counts use exact integer arithmetic, including the 340,282,366,920,938,463,463,374,607,431,768,211,456 addresses in an IPv6 /0.

### Does it support both IPv4 and IPv6?

Yes. Range mode accepts two addresses from the same version, and CIDR mode accepts prefixes from /0 to /32 for IPv4 or /0 to /128 for IPv6. Compressed IPv6 notation such as 2001:db8::1 is supported.

### Why can one IP range produce several CIDR blocks?

One CIDR block must contain a power-of-two number of addresses and begin on a matching binary boundary. If the requested range starts off that boundary or has another length, several blocks are required to cover it exactly without including extra addresses.

### Does the result include both range endpoints?

Yes. The start and end addresses are inclusive. A range with identical endpoints becomes one IPv4 /32 or IPv6 /128 block, and the address count is one.

### How is this different from the IPv4 subnet calculator?

This converter starts with two endpoints and finds the smallest exact CIDR list, or expands one IPv4 or IPv6 CIDR. The IPv4 subnet calculator instead starts with a host and prefix or subnet mask, then reports broadcast, wildcard mask, and usable-host details.

## Related tools

- [IPv4 Subnet Calculator](https://candoya.com/tools/ipv4-subnet-calculator/)
- [Number Base Converter](https://candoya.com/tools/number-base-converter/)
- [URL Parser](https://candoya.com/tools/url-parser/)
- [Cron Expression Builder](https://candoya.com/tools/cron-expression-builder/)
- [Data Storage Converter](https://candoya.com/tools/data-storage-converter/)

---

*Markdown edition of <https://candoya.com/tools/cidr-range-calculator/>, published for AI agents and other automated readers. Index of key pages: <https://candoya.com/llms.txt>.*
