CIDR TOOLS

CIDR calculator: details, ranges, overlaps and merging

Work out what a CIDR block contains, turn an IP range into CIDR blocks, check whether one address or block is inside another, and merge a long list into the fewest blocks. IPv4 and IPv6.

CIDR tools
Everything is calculated in your browser, for IPv4 and IPv6. Nothing you enter is sent to a server.
The basics

What is CIDR notation?

CIDR (Classless Inter-Domain Routing) writes a block of IP addresses as an address and a prefix length, such as 192.168.1.0/24. The number after the slash says how many of the leading bits are fixed to identify the network. The remaining bits can vary across the addresses in the block, so a /24 in IPv4 holds 28 = 256 addresses, and each step down in prefix length doubles the size.

Firewall rules, cloud security groups, routing tables and allowlists are all written this way. This page covers the jobs that come up around them: working out what a block contains, turning a range of addresses into blocks, checking whether one address or block sits inside another, and merging a long list into the smallest list that covers the same addresses. For quick IPv4 subnetting and splitting, the subnet calculator is also available.

Reference

IPv4 prefix lengths at a glance

PrefixNetmaskAddressesTypical use
/8255.0.0.016,777,216Very large block
/16255.255.0.065,536Large network
/24255.255.255.0256Home or office subnet
/27255.255.255.22432Small subnet
/30255.255.255.2524Router link (2 hosts)
/31255.255.255.2542Point-to-point link
/32255.255.255.2551Single host
Why merge lists

Range to CIDR, and why summarising helps

Ranges become blocks

Providers often publish address ranges as "first to last". Most firewalls only accept CIDR blocks, so a range has to be split into the fewest aligned blocks that cover it exactly. The converter does this, and the result never includes an address outside the range.

Shorter lists, same coverage

Merging removes entries that are already covered by a bigger block and joins neighbouring blocks into one. A list of 400 lines can often shrink to a handful, which keeps rule sets within provider limits.

IPv6 works the same way

The tools accept IPv6 too. IPv6 blocks are very large, so sizes are shown as exact numbers and as a power of two, and the number of /64 subnets is given for prefixes up to /64.

Checking a rule

Use Contains / overlap to confirm that an address is covered by a rule, or to find out whether two blocks clash before you add them to the same routing table.

FAQ

Frequently asked questions

What does /24 mean?

It means the first 24 bits of the address identify the network and the last 8 bits identify hosts. In IPv4 that is a block of 256 addresses with the netmask 255.255.255.0.

How many addresses are in a CIDR block?

The block holds 2 to the power of (address bits minus prefix length) addresses: 2(32 minus prefix) for IPv4 and 2(128 minus prefix) for IPv6. A /24 has 256, a /16 has 65,536.

How do I convert an IP range to CIDR?

Enter the first and last address in the Range to CIDR tab. The result is the smallest list of CIDR blocks that covers exactly that range and nothing else. Many ranges need several blocks, because a block has to start on an address that fits its size.

How do I check whether an IP address is inside a CIDR block?

Use the Contains / overlap tab. Enter the address and the block and it tells you whether the address is inside. You can also compare two blocks to see whether one contains the other, they partly overlap, or they are separate.

What is the difference between a network address and the first usable address?

In IPv4, the first address of a block is the network address and the last is the broadcast address, so the usable host range is between them. The /31 and /32 blocks are exceptions: a /31 has two usable addresses for point-to-point links and a /32 is a single host.

Can I use this for IPv6?

Yes. Every tab accepts IPv6 addresses and blocks, including compressed forms such as 2001:db8::/32. IPv4 and IPv6 cannot be compared with each other, so a merged list is shown separately for each version.

What does merging a list do?

It converts every line to an address range, sorts them, joins ranges that overlap or touch, and writes the result as the fewest CIDR blocks. The merged list covers exactly the same addresses as your original list.

Guides

Read more