IP range to CIDR
Enter the first and last address of a range to get the fewest CIDR blocks that cover exactly that range. Switch to many ranges to convert a list.
CIDR blocks
Example: type your own range above.
192.0.2.10/31 192.0.2.12/30 192.0.2.16/28 192.0.2.32/27 192.0.2.64/27 192.0.2.96/30 192.0.2.100/32
Each block
first and last address, and size
| Block | First | Last | Addresses |
|---|---|---|---|
| 192.0.2.10/31 | 192.0.2.10 | 192.0.2.11 | 2 |
| 192.0.2.12/30 | 192.0.2.12 | 192.0.2.15 | 4 |
| 192.0.2.16/28 | 192.0.2.16 | 192.0.2.31 | 16 |
| 192.0.2.32/27 | 192.0.2.32 | 192.0.2.63 | 32 |
| 192.0.2.64/27 | 192.0.2.64 | 192.0.2.95 | 32 |
| 192.0.2.96/30 | 192.0.2.96 | 192.0.2.99 | 4 |
| 192.0.2.100/32 | 192.0.2.100 | 192.0.2.100 | 1 |
- Block
- 192.0.2.10/31
- First
- 192.0.2.10
- Last
- 192.0.2.11
- Addresses
- 2
- Block
- 192.0.2.12/30
- First
- 192.0.2.12
- Last
- 192.0.2.15
- Addresses
- 4
- Block
- 192.0.2.16/28
- First
- 192.0.2.16
- Last
- 192.0.2.31
- Addresses
- 16
- Block
- 192.0.2.32/27
- First
- 192.0.2.32
- Last
- 192.0.2.63
- Addresses
- 32
- Block
- 192.0.2.64/27
- First
- 192.0.2.64
- Last
- 192.0.2.95
- Addresses
- 32
- Block
- 192.0.2.96/30
- First
- 192.0.2.96
- Last
- 192.0.2.99
- Addresses
- 4
- Block
- 192.0.2.100/32
- First
- 192.0.2.100
- Last
- 192.0.2.100
- Addresses
- 1
How it works
A CIDR block always holds a power of two addresses (1, 2, 4, 8, 16…) and must start on a multiple of its own size. A /24 starts at .0, a /25 at .0 or .128, a /26 at .0, .64, .128 or .192.
Most ranges don't line up like that, so they need several blocks. 192.0.2.10 to 192.0.2.100 becomes seven blocks: .10/31, .12/30, .16/28, .32/27, .64/27, .96/30 and .100/32. The tool starts at the first address, takes the largest block that fits without passing the last address, and repeats. That gives the fewest blocks possible, and they cover the range exactly.
Firewalls, mail server allowlists and SPF records (the DNS record that lists which servers may send email for your domain) all want CIDR blocks, not ranges. To merge many blocks into a shorter list, use the CIDR aggregator. To go the other way, use CIDR to range.