# cidrToRange() function · @imqueue/net

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

Expands a CIDR record into the first and last address it covers, as text.

**Signature:**

```typescript
export declare function cidrToRange(cidr: string, type?: NetworkType, canonical?: boolean): [string, string];
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| cidr | string | a network in `address/prefix` form |
| type | [NetworkType](https://imqueue.org/api/net/latest/net.networktype/) | _(Optional)_ the family, if known; omit to have it detected |
| canonical | boolean | _(Optional)_ for IPv6, render the expanded form instead of the compressed one |


**Returns:**

\[string, string\]

A `[first, last]` tuple of addresses, both ends inclusive.

## Exceptions

TypeError or RangeError exactly as [cidrToRangeInt()](https://imqueue.org/api/net/latest/net.cidrtorangeint/) does — this is that function with [intToIp()](https://imqueue.org/api/net/latest/net.inttoip/) applied to each end.

## Default Value

`canonical` defaults to `false`

## Example


```typescript
cidrToRange('10.0.0.0/8');        // ['10.0.0.0', '10.255.255.255']
cidrToRange('2001:db8::/32');     // ['2001:db8::', '2001:db8:ffff:...:ffff']
```

