IP range to CIDR converter
Paste a range such as 10.0.0.5-10.0.0.70, a list of blocks, or both. The page gives the fewest CIDR blocks that cover exactly those addresses, merges blocks that overlap or touch, and checks whether an address is in the list. It works for IPv4 and IPv6.
Blocks
Is an address in the list?
How a range becomes blocks
A CIDR block is an address, a slash and a prefix length: the number of leading bits that every address in the block shares. A /24 holds 256 addresses and a /30 holds 4. Each block holds a power of two, and it starts at a multiple of its size.
So a range that does not start and end on those lines needs more than one block. The converter takes the largest block that starts at the first address and ends inside the range, then does the same from the next address. That gives the fewest blocks that cover the range and nothing more. For 10.0.0.5 - 10.0.0.70 it gives eight:
| Block | First address | Last address | Addresses |
|---|---|---|---|
10.0.0.5/32 | 10.0.0.5 | 10.0.0.5 | 1 |
10.0.0.6/31 | 10.0.0.6 | 10.0.0.7 | 2 |
10.0.0.8/29 | 10.0.0.8 | 10.0.0.15 | 8 |
10.0.0.16/28 | 10.0.0.16 | 10.0.0.31 | 16 |
10.0.0.32/27 | 10.0.0.32 | 10.0.0.63 | 32 |
10.0.0.64/30 | 10.0.0.64 | 10.0.0.67 | 4 |
10.0.0.68/31 | 10.0.0.68 | 10.0.0.69 | 2 |
10.0.0.70/32 | 10.0.0.70 | 10.0.0.70 | 1 |
A list is merged the same way: ranges that overlap or touch are joined first, and each joined range is split into blocks. 10.0.0.0/25 and 10.0.0.128/25 become 10.0.0.0/24. RFC 4632 calls this aggregation: a network announces one route for the larger block in place of the smaller ones.
What the list takes
| Form | Example | Read as |
|---|---|---|
| An address | 192.0.2.7 | That address alone: 192.0.2.7/32. |
| A block | 172.16.0.0/22 | The block. An address inside it with a prefix, such as 172.16.1.9/22, is read as its block. |
| An address and a subnet mask | 10.1.0.0 255.255.255.0 | 10.1.0.0/24. |
| An address and a wildcard mask | 10.1.0.0 0.0.0.255 | 10.1.0.0/24, as router access lists write it. |
| A range | 10.0.0.5 - 10.0.0.70 | Every address from the first to the last. The dash may have spaces around it, or be the word to. |
| A short range | 192.168.1.10-20 | 192.168.1.10 - 192.168.1.20: the number after the dash replaces the last part. |
| IPv6 | 2001:db8::/48, 2001:db8::1-2001:db8::ff | Blocks and ranges as for IPv4. IPv6 has no masks. |
Some masks read two ways. 10.0.0.1 0.0.0.0 is read as that address alone (a wildcard mask), 0.0.0.0 0.0.0.0 as every address, and 10.0.0.1 255.255.255.255 as that address alone (a subnet mask). The page says so when it meets one.
Sources
- CIDR notation, blocks of a power of two, and aggregation: RFC 4632 (sections 3.1 and 4.1). IPv6 prefixes: RFC 4291 section 2.3.
- Wildcard masks in access lists: Cisco's document Configure IP Access Lists (document ID 23602).
- The blocks themselves are arithmetic; the examples were checked with another program.
More Network tools
-
CIDR subnet calculator
Network, broadcast, host range, subnet mask and wildcard mask for IPv4 and IPv6 prefixes.
-
IP address type checker
See whether an address is private, CGNAT, link-local, loopback, documentation, multicast or public, with its RFC.
-
IPv6 expander, compressor and reverse name
Write an IPv6 address in full or in its shortest form, get its ip6.arpa name, or build one from a MAC address.
-
MAC address format converter
Convert MAC addresses between colons, dashes, Cisco's dotted form and plain hex, and read the multicast and local bits.
-
MTU and MSS calculator
Work out the MTU and TCP MSS inside PPPoE, GRE, VXLAN, WireGuard and IPsec, with ping commands that test them.
-
Port number lookup
Look up a port such as 445 or 5985, or a service name, in IANA's registry, with what Windows and Active Directory use it for.
-
DHCP option encoder and decoder
Build or read the hex of option 121 and 249 static routes, option 119 search lists and option 43 for Cisco and UniFi.
-
NPS reason code lookup
Read why Network Policy Server denied a request: events 6273 and 6274, and reason codes such as 16, 48 and 65.
-
Wi-Fi reason and status codes
Look up 802.11 deauthentication and disassociation reason codes and association status codes.
-
DSCP and ToS converter
Convert DSCP, ToS and CoS values, with the Wi-Fi priorities of RFC 8325 and the Teams QoS markings.