How to Check if Two CIDR Blocks Overlap

Two IPv4 CIDR blocks overlap when they share at least one IP address. Checking for overlap is one of the most common tasks in network planning — before peering VPCs, building VPN tunnels, or merging office networks. This guide shows two reliable methods, worked examples, and the mistakes that cause real outages.

What CIDR overlap means

Every CIDR block is a continuous range of addresses. 10.0.0.0/24 covers 10.0.0.0 through 10.0.0.255, and 10.0.0.128/25 covers 10.0.0.128 through 10.0.0.255. Because the second range sits entirely inside the first, the two blocks overlap. Two blocks are disjoint only when one range ends before the other begins.

Why CIDR overlap matters

Method 1: compare address ranges

Convert each block to its start and end addresses. Two ranges overlap when:

a.start <= b.end AND b.start <= a.end

For 10.0.0.0/24: start 10.0.0.0, end 10.0.0.255. For 10.0.0.128/25: start 10.0.0.128, end 10.0.0.255. The first range’s start is before the second’s end, and the second’s start is before the first’s end — so they overlap. This test also catches containment, where one block sits entirely inside another.

Method 2: check whether one network start falls inside the other range

For each block, ask whether its network address lies within the other block’s range. In the example above, 10.0.0.128 (the start of the /25) lies inside 10.0.0.0/24, which immediately proves overlap. The caveat: you must test both directions, because either block can contain the other. When the two blocks are identical, this check alone still works — each network address lies inside the other range.

Practical examples

Example 1 — overlap

10.0.0.0/24 (10.0.0.0 – 10.0.0.255) and 10.0.0.128/25 (10.0.0.128 – 10.0.0.255): overlap.

Example 2 — no overlap

10.0.0.0/24 (10.0.0.0 – 10.0.0.255) and 10.0.1.0/24 (10.0.1.0 – 10.0.1.255): the first range ends at 10.0.0.255 and the next begins at 10.0.1.0 — no overlap.

Example 3 — containment

10.0.0.0/8 (10.0.0.0 – 10.255.255.255) and 10.255.255.255/32 (a single address): the /32 lies inside the /8 — overlap.

Real-world conflict examples

Common mistakes

When CIDR blocks do NOT overlap

Blocks are disjoint when one range ends before the other begins, or when they are exactly adjacent. A quick sanity check: if the highest address of the smaller-range block is lower than the lowest address of the other block, there is no overlap.

FAQ

Does overlapping mean the two blocks are identical?

No. Identical blocks overlap, but so do partial overlaps and containment.

Can I peer two AWS VPCs with overlapping CIDRs?

No. AWS rejects peering between VPCs whose CIDR blocks overlap, even partially.

Are adjacent subnets overlapping?

No. 10.0.0.0/25 and 10.0.0.128/25 are adjacent and share no address.

Do I need to check both directions?

Yes — either block can contain the other, so test each range against the other.

Check your networks with our CIDR Overlap Detector

Enter two CIDR blocks and see their exact ranges and the shared overlap range instantly.

CIDR Overlap Detector

Related tools