CIDR Subtraction
cidr-subtractUse to prepare WireGuard AllowedIPs exceptions or calculate remaining address space relative to supplied include and exclude lists. Compute union(include) minus union(exclude) as a minimal sorted canonical CIDR list, without adding addresses. Use one address family, a nonempty include list, and at most 1000 entries across both lists, up to 64 characters each. Exclude may be empty. Normalize host bits and count overlaps once. Return cidrs, normalizedInclude, normalizedExclude, and exact decimal-string includedAddressCount, removedAddressCount, remainingAddressCount. Complete removal returns an empty list; more than 10000 output CIDRs returns an error without a partial result. Error issues identify include or exclude and the zero-based entry index. Remote calls submit inputs to this server; the browser calculates locally. This does not inspect live allocation, configure WireGuard, or change firewall rules.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exclude | Yes | Ranges to remove from the included address space. An empty array simplifies the exact include union. | |
| include | Yes | The nonempty included address space. Use at most 1,000 entries across include and exclude, from one address family. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cidrs | Yes | ||
| family | Yes | ||
| normalizedExclude | Yes | ||
| normalizedInclude | Yes | ||
| removedAddressCount | Yes | Exact number of addresses as a base-10 string, including network and broadcast addresses. | |
| includedAddressCount | Yes | Exact number of addresses as a base-10 string, including network and broadcast addresses. | |
| remainingAddressCount | Yes | Exact number of addresses as a base-10 string, including network and broadcast addresses. |