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.
Calculated Boundaries & ParametersReady
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.
Related Subnet Math & Set OperationsAll Tools
Bitwise Subnet Calculator
Show address-and-mask operations.
IP Address Offset Calculator
Add or subtract address positions.
Address Distance Calculator
Count positions between two addresses.
Subnet Boundary Checker
Check alignment to a specified prefix.
IP-in-Range Checker
Test whether an address belongs.
IP-in-Subnet Checker
Test membership within a CIDR block.
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.
Enter set A
Type the base set, such as
10.0.0.0/22.Enter set B
Type the addresses to remove, such as
10.0.1.0/24.Cut each range
The calculator keeps the part of A before B and the part of A after B.
Output the remainder
The result is
10.0.0.0/24and10.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 = ANothing 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 A | Remove B | Remaining CIDR Blocks | Remaining Size |
|---|---|---|---|
| 10.0.0.0/22 | 10.0.1.0/24 | 10.0.0.0/24, 10.0.2.0/23 | 768 |
| 10.0.0.0/24 | 10.0.0.0/25 | 10.0.0.128/25 | 128 |
| 10.0.0.0/24 | 10.0.0.64/26 | 10.0.0.0/26, 10.0.0.128/25 | 192 |
| 192.168.0.0/16 | 192.168.100.0/24 | 192.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/17 | 65,280 |
| 172.16.0.0/24 | 172.16.1.0/24 | 172.16.0.0/24 | 256 |
| 203.0.113.0/24 | 203.0.113.0/24 | Empty set | 0 |
| 10.10.0.0/23 | 10.10.1.255/32 | 10.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/32 | 511 |
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.