IP Range to CIDR Converter
Firewalls, cloud security groups and allow-lists want CIDR blocks, but ranges usually arrive as a first and last address. Enter a range to get the minimal set of blocks that covers it exactly, expand blocks back into ranges, or paste a whole list of addresses, blocks and ranges to have it de-duplicated, merged and sorted. Everything is worked out on this page.
10.0.0.5 - 10.0.0.99 into the first box and leave the second empty.How to use
- Choose a mode: Range → CIDR, CIDR → range, or Merge list.
- For Range → CIDR, enter the first and last address, or paste a range such as 10.0.0.5 - 10.0.0.99 into the first box.
- For CIDR → range, enter one block per line to see each block's first address, last address and size.
- For Merge list, paste addresses, CIDR blocks and ranges in any order, one per line. Duplicates, overlaps and neighbouring blocks are combined into the fewest possible blocks, sorted.
- The result updates as you type. Copy it, or download it as a .txt file.
Examples
192.168.0.10/31, 192.168.0.12/30, 192.168.0.16/28, 192.168.0.32/27, 192.168.0.64/26, 192.168.0.128/26, 192.168.0.192/29, 192.168.0.200/32 (8 blocks, 191 addresses)
0.0.0.0/0
172.16.0.0 - 172.31.255.255 (1,048,576 addresses)
10.0.0.0/23 and 10.0.2.0/24 (768 addresses)
2001:db8::1/128, 2001:db8::2/127, 2001:db8::4/127, 2001:db8::6/128
Supported formats
- IPv4 in dotted-decimal form (192.168.1.10) and IPv6 in any standard form, including :: shorthand and an embedded IPv4 tail (::ffff:192.0.2.1).
- CIDR blocks as address/prefix (10.0.0.0/8, 2001:db8::/32); for IPv4 a dotted netmask after the slash also works (192.168.1.0/255.255.255.0).
- Ranges as start - end, start – end or start to end. In lists, anything after # is a comment and commas separate entries too.
- Output: one CIDR block per line, IPv4 first, then IPv6, with IPv6 written in the RFC 5952 short form.
Privacy
This tool runs entirely in your browser. Nothing you enter or open is sent anywhere. Privacy policy.
Limitations
- IPv4 octets with leading zeros (such as 010.0.0.1) are rejected rather than guessed, because some software reads them as octal and some as decimal.
- A CIDR block with host bits set (such as 192.168.1.77/24) is treated as its network (192.168.1.0/24); the CIDR → range mode says when this happens.
- Hostnames, wildcard notation (10.0.*.*), shortened ranges (10.0.0.1-50) and IPv6 zone indexes (fe80::1%eth0) are not accepted.
- IPv4 and IPv6 are never merged with each other, and IPv4-mapped IPv6 addresses (::ffff:a.b.c.d) are kept as IPv6.
FAQ
Why does one range turn into several CIDR blocks?
A CIDR block always holds a power of two addresses and must start on a multiple of its own size. A range such as 192.168.0.10 to 192.168.0.200 does not line up with those boundaries, so it is covered by a run of blocks that get bigger towards the middle and smaller towards the end. The tool picks the largest block that fits at each step, which gives the fewest blocks possible.
What is the difference between merging and summarizing routes?
Merging here is exact: the output covers precisely the same addresses as the input, nothing more. Route summarization on a router often advertises a larger block that also includes unused addresses. This tool never adds addresses you did not list, so it does not produce that kind of covering supernet.
Why are 10.0.1.0/24 and 10.0.2.0/24 not joined into a /23?
A /23 must start on an even third octet, so 10.0.1.0/24 and 10.0.2.0/24 belong to different /23s (10.0.0.0/23 and 10.0.2.0/23). Joining them would add 256 addresses you did not list. 10.0.0.0/24 and 10.0.1.0/24, on the other hand, merge into 10.0.0.0/23.
Are my addresses sent anywhere?
No. The parsing and the arithmetic run in your browser using JavaScript's BigInt numbers, and the page makes no network requests with what you type.