IPv4 range expander
Given a start and an end IPv4 address, this tool calculates a valid IPv4 subnet along with its CIDR notation.
About IPv4 range expander
Given the first and last address of a range, finds the smallest CIDR block that contains the whole range, and shows how many addresses the block covers compared with the range you asked for.
When you would use it
- Turning a range such as 10.0.4.17 to 10.0.6.200 into a CIDR for a firewall, security group or route.
- Checking how much larger the aligned block is than the range you actually need.
- Converting legacy start/end style allow-lists into prefix notation.
How to use it
- Enter the start and the end address.
- Read the result table: the original and the expanded start and end, the number of addresses and the CIDR.
- If the end is lower than the start, use the swap button to exchange them.
Things worth knowing
- A CIDR block must be aligned to a power of two, so the result is often larger than the range: the start is rounded down and the end rounded up to the block boundaries. Check the "addresses in range" row before using the CIDR in a rule, because the extra addresses are included too.
- A range that is not already a block cannot be expressed as one CIDR without including extra addresses. If that is unacceptable, split it into several blocks by hand.
- The expansion compares the two addresses bit by bit and keeps the common prefix, so ranges whose start and end differ in a high bit expand to a very large block (even /0).
- Start and end are remembered in this browser between visits.
Frequently asked questions
- Why does my range of 1000 addresses become a /22 with 1024?
- Because 1000 is not a power of two and the range is not aligned. The smallest block that contains all 1000 addresses is 1024 addresses wide.
- How do I get an exact list of blocks instead?
- Split the range at power-of-two boundaries: repeatedly take the largest aligned block that starts at the current start address and fits in the range, then continue from the next address.