# intRangeToCidr() function · @imqueue/net

Source: https://imqueue.org/api/net/latest/net.intrangetocidr/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/net 3.0.2 — generated reference, not hand-written

Covers an integer address range with the fewest CIDR records that fit it exactly.

**Signature:**

```typescript
export declare function intRangeToCidr(start: bigint, end: bigint, type: NetworkType, canonical?: boolean): string[];
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| start | bigint | first address in the range, inclusive |
| end | bigint | last address in the range, inclusive |
| type | [NetworkType](https://imqueue.org/api/net/latest/net.networktype/) | which family the two integers belong to |
| canonical | boolean | _(Optional)_ for IPv6, render expanded rather than compressed addresses |


**Returns:**

string\[\]

The records covering exactly `[start, end]` — no more and no less.

## Default Value

`canonical` defaults to `false`

## Remarks

The inverse of [cidrToRangeInt()](https://imqueue.org/api/net/latest/net.cidrtorangeint/), and not a one-to-one one: an arbitrary range rarely aligns to a single prefix, so this splits it into the minimal set that does. A range already on a prefix boundary comes back as one record.

`type` is required here and cannot be inferred, for the same reason as in [intToIp()](https://imqueue.org/api/net/latest/net.inttoip/) — the integers alone do not say which family they are. The range is not validated, so an `end` below `start` yields an empty list rather than an error.

