Calculators and converters Runs in your browser

IP range calculator

Turn IP ranges into CIDR blocks and back.

price
Free
account
Not needed
runs
In your browser
Ready

IPv4 or IPv6; both ends must be the same version. You can also paste a whole range like 10.0.0.0 - 10.0.3.255 into the first field.

Try

What the IP range calculator does

Firewalls, cloud security groups, allowlists and routing tables usually want CIDR blocks, while ranges from a provider, a log file or an IP database are often written as a first and last address. This tool converts in both directions, for IPv4 and IPv6.

  • Range to CIDR: enter a first and last address to get the smallest list of CIDR blocks that covers exactly that range, no more and no less.
  • CIDR to range: paste one or more blocks, one per line, to get the first and last address of each and the number of addresses it holds. Tick the merge option to combine overlapping or adjacent blocks into the shortest possible list.

All the math runs in your browser with exact big-integer arithmetic, so even IPv6 counts with dozens of digits are shown precisely. Nothing you enter is sent to our server.

How to read the result

A range fits in a single CIDR block only when it starts on a block boundary and its size is a power of two. For example, 10.0.0.0 to 10.0.3.255 is exactly 10.0.0.0/22. Most ranges aren't that tidy, so they turn into a staircase of blocks: 192.168.0.1 to 192.168.0.254 needs 14 of them, from a single /32 at each end up to two /26 blocks in the middle. The list the tool returns is always the shortest one possible.

The address count includes every address in the range. If you are planning host addresses on an IPv4 network, keep in mind that the first (network) and last (broadcast) address of each subnet are normally not given to devices. The subnet calculator shows the usable hosts of a single block.

Common questions

Why does my range turn into so many blocks?

Every CIDR block has to start at an address that's a multiple of its size. A range that starts at .1 or ends at .254 breaks that alignment at both edges, so the tool fills each edge with smaller blocks. If you can widen the range to block boundaries, such as .0 to .255, you get one block instead.

Can I mix IPv4 and IPv6?

Not in one range: the first and last address must be the same version. In the CIDR list you can mix them freely, and totals are shown for each version separately.

What if I type the addresses the wrong way round?

If the first address is higher than the last, the tool swaps them and tells you, so you still get the right blocks.

What if a block has host bits set?

An entry like 10.0.0.5/24 isn't a proper network address. The tool converts it to its network, 10.0.0.0/24, and shows a note so you can fix the source list.