Free IP range to CIDR converter
IP Range to CIDR Converter
Enter the first and last address of a range to get the fewest CIDR blocks that cover it exactly. A range only becomes one block when it starts on a boundary and its size is a power of two: 192.168.1.0 to 192.168.1.255 is 192.168.1.0/24, while 10.0.0.5 to 10.0.0.20 needs five.
Convert a range
10.0.0.5 – 10.0.0.20 as 5 CIDR blocks
This is an example result. Enter your own range above and press Convert.
- CIDR blocks
- 5
- Addresses covered
- 16
| CIDR | First address | Last address | Addresses | Copy |
|---|---|---|---|---|
| 10.0.0.5/32 | 10.0.0.5 | 10.0.0.5 | 1 | |
| 10.0.0.6/31 | 10.0.0.6 | 10.0.0.7 | 2 | |
| 10.0.0.8/29 | 10.0.0.8 | 10.0.0.15 | 8 | |
| 10.0.0.16/30 | 10.0.0.16 | 10.0.0.19 | 4 | |
| 10.0.0.20/32 | 10.0.0.20 | 10.0.0.20 | 1 |
How a range becomes CIDR blocks
Start at the first address. Take the biggest block that begins there (the more zero bits at the end of the address, the bigger it can be) without going past the last address. Move to the first address after that block and repeat until the range is covered.
For 10.0.0.5 to 10.0.0.20: the address ends in …101 in binary, so only a single address fits (/32). Then .6 can start a /31, .8 a /29, .16 a /30 and .20 a /32. Greedy from the left always gives the fewest blocks.
Going the other way? The CIDR calculator shows the first and last address of any block, and the overlap checker tells you whether the blocks you got clash with others.
Built and maintained by Bhavesh Vala. Last reviewed . Every calculation uses the same tested rules as the subnet planner, including /31, /32 and IPv6. About