Skip to main content
IP Range CalculatorPRO
Subnet Math & Set OperationsInstant Client-Side Tool

Range Difference Calculator

Remove one address set from another.

Range Difference Calculator: inputs and results

Enter an IP address, CIDR prefix, or range. Then check its first and last address below.

Quick presets:

Calculated Boundaries & ParametersReady

Network Address192.168.1.0
Broadcast Address192.168.1.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
Total Addresses256
Usable Host Range254

Key Capabilities

  • •100% Client-Side: Zero telemetry or server latency.
  • •RFC Compliant: Exact 32-bit and 128-bit integer precision.
  • •Quick Copy: Instant access to CIDR, mask, and range bounds.
  • •Cross-Platform: Works on desktop, tablet, and mobile browsers.

How Range Difference Calculator Works?

This tool works by removing every address of set B from set A, which can leave 0, 1, or 2 pieces of each A range.

  1. Enter set A

    Type the base set, such as 10.0.0.0/22.

  2. Enter set B

    Type the addresses to remove, such as 10.0.1.0/24.

  3. Cut each range

    The calculator keeps the part of A before B and the part of A after B.

  4. Output the remainder

    The result is 10.0.0.0/24 and 10.0.2.0/23, a total of 768 addresses.

Range Difference Calculator Formula

The formula is A − B = [S_A, S_B − 1] ∪ [E_B + 1, E_A], keeping only non-empty pieces.

Left piece

[S_A, S_B − 1]

Exists when S_B > S_A.

Right piece

[E_B + 1, E_A]

Exists when E_B < E_A.

No overlap

A − B = A

Nothing to remove.

Size

|A| − |A ∩ B|

Remaining addresses.

Worked example: 10.0.0.0/22 − 10.0.1.0/24

A = 10.0.0.0 – 10.0.3.255 (1,024)
B = 10.0.1.0 – 10.0.1.255 (256)
Left  = 10.0.0.0 – 10.0.0.255 → 10.0.0.0/24
Right = 10.0.2.0 – 10.0.3.255 → 10.0.2.0/23
Remaining = 768 addresses

Range Difference Calculator Conversion Table

The table subtracts B from A for 7 pairs and lists the remaining CIDR blocks.

Set ARemove BRemaining CIDR BlocksRemaining Size
10.0.0.0/2210.0.1.0/2410.0.0.0/24, 10.0.2.0/23768
10.0.0.0/2410.0.0.0/2510.0.0.128/25128
10.0.0.0/2410.0.0.64/2610.0.0.0/26, 10.0.0.128/25192
192.168.0.0/16192.168.100.0/24192.168.0.0/18, 192.168.64.0/19, 192.168.96.0/22, 192.168.101.0/24, 192.168.102.0/23, 192.168.104.0/21, 192.168.112.0/20, 192.168.128.0/1765,280
172.16.0.0/24172.16.1.0/24172.16.0.0/24256
203.0.113.0/24203.0.113.0/24Empty set0
10.10.0.0/2310.10.1.255/3210.10.0.0/24, 10.10.1.0/25, 10.10.1.128/26, 10.10.1.192/27, 10.10.1.224/28, 10.10.1.240/29, 10.10.1.248/30, 10.10.1.252/31, 10.10.1.254/32511

What is Range Difference Calculator?

The Range Difference Calculator is a tool that subtracts one IPv4 address set from another and returns the addresses left over.

Difference is the "A AND NOT B" of address sets. Typical cases: a large allowed range minus a few exception subnets, or a parent block minus allocated space.

Removing a small block from the middle of a large block splits the remainder into several CIDR blocks. Removing a single /32 from a /16 leaves 16 blocks, from a /17 down to a /32.

What are the uses of Range Difference Calculator?

There are 4 main uses of the Range Difference Calculator, including exception handling, split tunneling, and cleanup.

  • Excluding exceptions from rules

    Allow 10.0.0.0/8 except 10.66.0.0/16 by permitting the difference.

  • Building split-tunnel lists

    VPN clients route the company space minus local office subnets.

  • Removing decommissioned space

    Retired subnets are subtracted from an active address list.

  • Comparing old and new allocations

    Old set minus new set shows addresses that left the plan.