CIDR Subtract Calculator
Remove a subnet from a larger CIDR block using recursive binary decomposition. The algorithm recursively splits the parent network into halves until the target subnet is isolated, then returns the remaining blocks. Also supports aggregating overlapping CIDRs into the minimum set and converting IP address ranges to CIDR notation.
The larger network you're subtracting from
The subnet to carve out of the parent
How CIDR Subtraction Works
- Parse parent & sub CIDR — validate both blocks and compute their IP ranges.
- Check overlap — if no overlap, parent is unchanged. If sub covers the entire parent, nothing remains.
- Recursive split — split the parent into two equal halves. Recursively subtract from each half.
- Collect remaining blocks — leaf blocks (/32) that are partially overlapped cannot be subdivided further.
Example: 10.0.0.0/22 subtract 10.0.1.0/24 → ["10.0.0.0/24", "10.0.2.0/23"]