CIDR to IP Range Converter

Convert CIDR to an IP range: enter a block like 10.0.0.0/30 to get its first and last address. It also works the other way, turning any start and end address into the fewest CIDR blocks.

Updated
Calculated in your browser. No address is looked up online.

IPv4 like 192.168.0.0/22 or IPv6 like 2001:db8::/120.

First address
–
Last address
–
Addresses in the block
–
Network (CIDR)
–

How to use the CIDR to IP Range Converter

  1. On CIDR to range, enter a CIDR block such as 192.168.0.0/22. Tick List every address if you need them one per line.
  2. On Range to CIDR, enter a Start address and an End address of the same IP version.
  3. Press Calculate, then copy the result or download it as a .txt file for a firewall rule or an allow list.

How it works

CIDR to range. For a block a/p, the first address is a with its last (bits − p) bits cleared, and the last address is the same with those bits set. The block holds 2^(bits − p) addresses, where bits is 32 for IPv4 and 128 for IPv6.

Range to CIDR. Starting at the first address, the converter takes the largest block that both starts on a boundary of its own size and ends at or before the last address. It repeats from the next address until the range is covered. This greedy method always gives the shortest possible list.

Examples

  • 10.0.0.0/30 = 10.0.0.0 to 10.0.0.3 (4 addresses).
  • Range 10.0.0.0 to 10.0.0.5 = 10.0.0.0/30 and 10.0.0.4/31.
  • 192.168.0.0/22 = 192.168.0.0 to 192.168.3.255 (1,024 addresses).
  • Range 192.168.1.10 to 192.168.1.20 needs four blocks: /31, /30, /30, and /32.
  • 2001:db8::/120 = 2001:db8:: to 2001:db8::ff (256 addresses).

Limitations

  • The address list stops at 65,536 entries. The count is always shown in full.
  • If the address in a CIDR block is not the start of the block, as in 10.0.0.5/30, the range of the block that contains it is shown, with a note.
  • Both ends of a range must be the same version. Mixed IPv4 and IPv6 ranges are rejected.

Frequently asked questions

What does /24 mean in 192.168.1.0/24?

The first 24 bits are the network part, so the block covers 192.168.1.0 to 192.168.1.255: 256 addresses.

How do I convert an IP range to CIDR?

Split the range into blocks whose size is a power of 2 and whose start is a multiple of that size. The Range to CIDR tab does this and returns the fewest blocks possible.

Why does one range need several CIDR blocks?

A CIDR block always has a power-of-2 size and starts on a matching boundary. A range like 10.0.0.0 to 10.0.0.5 (6 addresses) can only be covered by a block of 4 plus a block of 2.

Often used together with the CIDR to IP Range.