CIDR / IPv4 / IPv6

IP Range to CIDR & CIDR to IP Range Converter

Paste ranges, CIDRs or single IPs and get the smallest exact set of CIDR blocks. Exclude what you do not want, check whether an IP is covered and copy the result as a list or as nginx or Apache lines.

  • IPv4 + IPv6 ranges and CIDRs in one list
  • Exclude ranges and check any IP
  • Copy as CIDR list, nginx, Apache, CSV or JSON
Load example

Calculated on this device. Inputs are not sent to an API, saved in a URL or stored by this tool.

Paste up to 1,000 entries. IPv4 and IPv6 can share a list.

How to use this calculator

  1. Paste one IP, CIDR or first–last range per line. Put anything to remove in the exclusion box.
  2. Select Convert & aggregate. Each block shows its first and last address, so a CIDR also converts to its IP range.
  3. Check an IP against the result, then turn on actual addresses and copy the format your firewall or server needs.

What aggregation changes

Overlapping, duplicate and adjacent ranges are joined before aligned CIDR blocks are calculated. Gaps remain excluded: 192.0.2.0/32 and 192.0.2.2/32 remain two entries. A CIDR with host bits set, such as 192.0.2.129/25, represents the complete network 192.0.2.128/25; normalization is counted explicitly. IPv4 and IPv6 are processed separately. Counts include every address in a block, including IPv4 network and broadcast addresses; they are not usable-host counts. This is address arithmetic, not proof of ownership, reachability or a live BGP routing plan.

Questions about range conversion

How do I convert a CIDR to an IP range?

Paste the CIDR, such as 10.0.0.0/22, and convert. The table shows its first and last address (10.0.0.0 – 10.0.3.255) and the address count. Small results can also be copied as a list of every IP.

Will aggregation add addresses to my allowlist?

No. The output covers exactly the union of the input addresses. Two separated ranges never become a broader supernet that fills the gap. Check that each input CIDR already describes the network you intend to allow.

Can I mix private IPv4, IPv6 and individual IPs?

Yes. Private and documentation ranges work because no network lookup is needed. Individual IPs become /32 or /128 blocks; IPv4-mapped IPv6 remains in the IPv6 family.

How large can a calculation be?

Up to 1,000 non-empty lines and 128 KiB of text, with at most 16,384 output blocks. Results are paged in groups of 48. Huge ranges are represented by blocks rather than expanded into hosts, and IPv6 counts use exact integer arithmetic.

Related tools