CalcWorldHub
Free online calculator · no signup

IPv4 CIDR overlap and containment calculator

Normalize two IPv4 CIDRs and determine overlap and containment using their numeric intervals.

4,000 tools
IPv4 CIDR overlap and containment calculator — First IPv4 address, First prefix, Second IPv4 address and calculation method
IPv4 CIDR overlap and containment calculator: inputs and calculation method.

How to use this calculator

Normalize two IPv4 CIDRs and determine overlap and containment using their numeric intervals.

  1. Enter First IPv4 address, First prefix, Second IPv4 address, Second prefix. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

IPv4 CIDR overlap and containment explained

Each IPv4 address and prefix describes a 32-bit address interval after host bits are masked. Comparing the two inclusive intervals gives their shared address count and whether either block contains the other; routing and usable-host conventions are separate questions.

Intersection address count128addresses
Intersection address count: 128 addresses in the worked scenario.

Inputs, symbols, and units

a — First IPv4 address
First IPv4 address.
p — First prefix
First prefix. Enter a whole number.
b — Second IPv4 address
Second IPv4 address.
q — Second prefix
Second prefix. Enter a whole number.

Formula and method

For each CIDR, mask host bits to get its inclusive network-to-broadcast interval; overlap is the intersection of those intervals.

Addresses need not be network addresses: prefix masking defines each interval. The count includes every address in the intersection, including network and broadcast addresses; it does not infer whether an address is assignable.

A worked scenario

First IPv4 address = 192.168.1.0; First prefix = 24; Second IPv4 address = 192.168.1.128; Second prefix = 25.

  • Intersection address count: 128 addresses
  • Relationship: First contains second

This scenario uses the stated units and assumptions. Displayed values are rounded only after calculation.

Assumptions and edge cases

Address-set comparison only; routes, permissions, and usable-host conventions are not inferred.

Frequently asked questions

Must addresses already be network addresses?

No, host bits are masked.

Are network and broadcast addresses counted?

Yes, all addresses in each block are counted.

Can two CIDRs partially overlap without containment?

For aligned CIDR blocks, overlap implies one contains the other.

How do I use the IPv4 CIDR overlap and containment calculator?

Enter First IPv4 address, First prefix, Second IPv4 address, Second prefix. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of IPv4 CIDR overlap and containment?

First IPv4 address = 192.168.1.0; First prefix = 24; Second IPv4 address = 192.168.1.128; Second prefix = 25. Intersection address count: 128 addresses Relationship: First contains second This scenario uses the stated units and assumptions. Displayed values are rounded only after calculation.