Network · Developer
IP range to CIDR.
Turn a start and end IPv4 address into the fewest CIDR blocks that cover it exactly, expand a CIDR block into its first and last address, or see any IPv4 address as a decimal, hex and binary number.
Inputs
Result
Enter a value, then press Convert.
How it's calculated
An IPv4 address is four octets, a single unsigned 32-bit number (RFC 791). That number is the decimal form: 192.168.1.1 is 3,232,235,777. A CIDR block with prefix length n covers 232−n addresses that share the first n bits, so it must start on a multiple of its own size (RFC 4632).
Range to CIDR is greedy from the low end: take the largest block that is aligned at the current address and still fits inside the remaining range, emit it, move past it, repeat. That gives the minimum number of blocks, the same result as Python's ipaddress.summarize_address_range. CIDR to range zeroes the host bits for the first address and sets them for the last; if you type host bits (10.1.2.3/8), the tool normalizes to the network (10.0.0.0/8) and says so.
Specs: RFC 791 (32-bit addresses) and RFC 4632 (CIDR prefixes). Need the mask, wildcard or usable hosts for one subnet? Use the subnet calculator.
Frequently asked questions
Why does my range give several CIDR blocks?
A single CIDR block must be a power-of-two size starting on an aligned address. A range like 10.0.0.1 to 10.0.0.6 is neither, so it takes several blocks. The list shown is the shortest possible.
Does it include network and broadcast addresses?
Yes. The blocks cover every address from start to end inclusive, with no addresses reserved. For usable hosts of one subnet, use the subnet calculator.
Does this work for IPv6?
No, this tool is IPv4 only.
Pure arithmetic — no network access
Everything is computed in your browser. Nothing is looked up, and the tool does not check whether an address is routed or assigned.