A range rarely lines up with one CIDR block, so there are two answers. The exact list covers precisely your addresses. A single block is shorter to write but also takes in whatever sits in between. Use the exact list for firewall rules and allowlists; a single block only where the extras are acceptable, such as a route summary.
192.168.1.10-192.168.1.20| Option | CIDR | Addresses | Not in your input |
|---|---|---|---|
| Exact list | 192.168.1.10/31, 192.168.1.12/30, 192.168.1.16/30, 192.168.1.20/32 | 11 | 0 |
| Single block | 192.168.1.0/27 | 32 | 21 (65.6%) |
10.0.0.0/24, 10.0.1.0/24, 10.0.2.0/24| Option | CIDR | Addresses | Not in your input |
|---|---|---|---|
| Exact list | 10.0.0.0/23, 10.0.2.0/24 | 768 | 0 |
| Single block | 10.0.0.0/22 | 1,024 | 256 (25%) |
Starting at the first address, take the largest CIDR block that is aligned at that address and still fits inside the range, then repeat from the address after it. Most ranges need several blocks; a range only becomes a single block when its start is aligned and its size is a power of two.
A CIDR block must start on a boundary that is a multiple of its size. A range such as 192.168.1.10 to 192.168.1.20 does not line up with one boundary, so it takes a /31, two /30s and a /32 to cover it exactly.
The exact list covers precisely the addresses you gave and nothing else. A covering block is the single smallest CIDR block that contains them all, which is shorter to write but usually includes addresses you did not ask for. Use the exact list for firewall and allowlist rules.
Paste the blocks, comma separated or one per line. Adjacent and overlapping blocks are merged and the result is the smallest exact set of blocks. If a single block would cover them, it is shown with the extra addresses it would add.
curl "https://networkcalc.com/api/range/192.168.1.10-192.168.1.20"
curl "https://networkcalc.com/api/range/10.0.0.0/24,10.0.1.0/24,10.0.2.0/24"
See the IP Range to CIDR API docs. Planning an address space instead? The VLSM calculator divides a network for several groups at once.