IPv6 range to CIDR
Enter the first and last address of an IPv6 range to get the fewest prefixes that cover exactly that range. Switch to many ranges to convert a list.
CIDR blocks
Example: type your own range above.
2001:db8::1/128 2001:db8::2/127 2001:db8::4/126 2001:db8::8/125 2001:db8::10/124 2001:db8::20/123 2001:db8::40/122 2001:db8::80/121
Each block
first and last address, and size
| Block | First | Last | Addresses |
|---|---|---|---|
| 2001:db8::1/128 | 2001:db8::1 | 2001:db8::1 | 1 |
| 2001:db8::2/127 | 2001:db8::2 | 2001:db8::3 | 2 |
| 2001:db8::4/126 | 2001:db8::4 | 2001:db8::7 | 4 |
| 2001:db8::8/125 | 2001:db8::8 | 2001:db8::f | 8 |
| 2001:db8::10/124 | 2001:db8::10 | 2001:db8::1f | 16 |
| 2001:db8::20/123 | 2001:db8::20 | 2001:db8::3f | 32 |
| 2001:db8::40/122 | 2001:db8::40 | 2001:db8::7f | 64 |
| 2001:db8::80/121 | 2001:db8::80 | 2001:db8::ff | 128 |
- Block
- 2001:db8::1/128
- First
- 2001:db8::1
- Last
- 2001:db8::1
- Addresses
- 1
- Block
- 2001:db8::2/127
- First
- 2001:db8::2
- Last
- 2001:db8::3
- Addresses
- 2
- Block
- 2001:db8::4/126
- First
- 2001:db8::4
- Last
- 2001:db8::7
- Addresses
- 4
- Block
- 2001:db8::8/125
- First
- 2001:db8::8
- Last
- 2001:db8::f
- Addresses
- 8
- Block
- 2001:db8::10/124
- First
- 2001:db8::10
- Last
- 2001:db8::1f
- Addresses
- 16
- Block
- 2001:db8::20/123
- First
- 2001:db8::20
- Last
- 2001:db8::3f
- Addresses
- 32
- Block
- 2001:db8::40/122
- First
- 2001:db8::40
- Last
- 2001:db8::7f
- Addresses
- 64
- Block
- 2001:db8::80/121
- First
- 2001:db8::80
- Last
- 2001:db8::ff
- Addresses
- 128
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.