# CIDR / IP Range Converter

Convert between CIDR notation and IP ranges for IPv4 and IPv6, in bulk (up to 1,000 lines and about 10,000 resulting blocks per call). A CIDR block returns its first and last address, exact size, netmask and wildcard. A start-end range returns the minimal exact list of CIDR blocks (at most 62 for IPv4, 254 for IPv6) plus the smallest single covering block and how many extra addresses it would admit. Accepts "a - b", "a to b" and short forms like 10.0.0.5-20. Pure calculation, no network access.

**Not for:** Subnet details such as usable hosts and broadcast (use subnet_calculate) or merging many overlapping networks.

- Tool id: `ip-range-convert`
- Category: ip
- Execution: pure
- MCP tool `ip_range_convert` at https://lookupowl.com/mcp
- REST `GET https://lookupowl.com/api/v1/tools/ip-range-convert` (or POST a JSON body)
- OpenAPI: https://lookupowl.com/api/openapi.json

## Input

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `input` | string | yes |  | One item per line (commas and semicolons also separate): CIDR blocks such as 10.0.0.0/24 or 2001:db8::/48, or ranges such as "10.0.0.1 - 10.0.0.9", "10.0.0.5-20", "192.0.2.1 to 192.0.2.77". IPv4 and IPv6, up to 1,000 items. max length 65536 |
| `mode` | "auto" \| "cidr-to-range" \| "range-to-cidr" | no | `"auto"` | auto detects each line; cidr-to-range expects CIDR blocks; range-to-cidr expects start-end ranges. |
| `family` | "4" \| "6" \| "any" | no | `"any"` | Only accept this IP family: 4, 6 or any. |

## Output

Results are wrapped in an envelope: `tool`, `version`, `requestId`, `data`, `summary`, `meta` (cache status, timing), `permalink`. `data` has these fields:

| Field | Type | Description |
|---|---|---|
| `items` | object[] |  |
| `totals` | object |  |
| `truncated` | boolean | True when more than 1,000 items were given and the rest were ignored. |

## Examples

### IPv4 CIDR to range

```json
{"input":"192.168.1.0/24\n10.0.0.0/22","mode":"cidr-to-range","family":"4"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-range-convert?family=4&input=192.168.1.0%2F24%0A10.0.0.0%2F22&mode=cidr-to-range'
```

Web page: https://lookupowl.com/cidr-to-ip-range?q=192.168.1.0%2F24%0A10.0.0.0%2F22

### IPv4 range to CIDR

```json
{"input":"10.0.0.5 - 10.0.0.20","mode":"range-to-cidr","family":"4"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-range-convert?family=4&input=10.0.0.5+-+10.0.0.20&mode=range-to-cidr'
```

Web page: https://lookupowl.com/ip-range-to-cidr?q=10.0.0.5+-+10.0.0.20

### IPv6 prefix to range

```json
{"input":"2001:db8::/32","mode":"cidr-to-range","family":"6"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-range-convert?family=6&input=2001%3Adb8%3A%3A%2F32&mode=cidr-to-range'
```

Web page: https://lookupowl.com/ipv6-cidr-to-range?q=2001%3Adb8%3A%3A%2F32

### IPv6 range to prefixes

```json
{"input":"2620:0:2d0:200::7-2620:0:2d0:2df::7","mode":"range-to-cidr","family":"6"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-range-convert?family=6&input=2620%3A0%3A2d0%3A200%3A%3A7-2620%3A0%3A2d0%3A2df%3A%3A7&mode=range-to-cidr'
```

Web page: https://lookupowl.com/ipv6-range-to-cidr?q=2620%3A0%3A2d0%3A200%3A%3A7-2620%3A0%3A2d0%3A2df%3A%3A7

### Mixed list, auto-detected

```json
{"input":"203.0.113.0/28\n198.51.100.10-198.51.100.20\n2001:db8::/126","mode":"auto","family":"any"}
```

```bash
curl 'https://lookupowl.com/api/v1/tools/ip-range-convert?family=any&input=203.0.113.0%2F28%0A198.51.100.10-198.51.100.20%0A2001%3Adb8%3A%3A%2F126&mode=auto'
```

Web page: https://lookupowl.com/cidr-to-ip-range?q=203.0.113.0%2F28%0A198.51.100.10-198.51.100.20%0A2001%3Adb8%3A%3A%2F126

## Web pages

- https://lookupowl.com/cidr-to-ip-range
- https://lookupowl.com/ip-range-to-cidr
- https://lookupowl.com/ipv6-cidr-to-range
- https://lookupowl.com/ipv6-range-to-cidr

## Limits and caching

- Cost: 1 unit for a live lookup, 1 unit for a cached one. Budgets are per network and published in the `RateLimit` response headers.
- Cache: results are kept for 86400 s.
- Timeout: 1 s.

## Related tools

- [IP Subnet Calculator](https://lookupowl.com/tools/subnet-calculator.md): Network, broadcast, usable range, masks and exact host counts for any IPv4 or IPv6 subnet.
- [IPv6 Compress and Expand](https://lookupowl.com/tools/ipv6-format.md): Shorten IPv6 addresses to RFC 5952 canonical form, or expand them to the full 32-digit form.
- [IP Address Converter](https://lookupowl.com/tools/ip-convert.md): Convert IP addresses to decimal, hex and binary, IPv4 to IPv6 forms, and pull the IPv4 out of an IPv6 address.
- [IP WHOIS Lookup](https://lookupowl.com/tools/ip-whois.md): Who owns an IPv4 or IPv6 address: network range, name, country, registry, abuse contact and origin AS, from RDAP.

## Guide: CIDR to IP range converter

Turn an IPv4 CIDR block into its first and last address, its size and its masks.

### What this converts

A CIDR block such as `192.168.1.0/24` is shorthand for a run of consecutive addresses. The number after the slash says how many leading bits are fixed, and the rest can take any value. This converter spells the run out, from the first address to the last, so you can paste it into a firewall rule, an access control list (ACL), a cloud security group or any tool that wants start and end addresses.

| CIDR | First address | Last address | Addresses |
|---|---|---|---|
| `192.168.1.0/24` | 192.168.1.0 | 192.168.1.255 | 256 |
| `10.0.0.0/22` | 10.0.0.0 | 10.0.3.255 | 1,024 |
| `172.16.0.0/12` | 172.16.0.0 | 172.31.255.255 | 1,048,576 |
| `203.0.113.8/29` | 203.0.113.8 | 203.0.113.15 | 8 |

### How to use it

1. **Paste your blocks**: One per line, or separated by commas or semicolons, up to 1,000 in one go. A bare address counts as a `/32`, a block of one.
2. **Read each row**: You get the first and last address, the exact count, the netmask and the wildcard mask, plus a warning about anything odd in the input. Under Other forms you also get the start and end as integers, and the reverse DNS zone when the block lines up with one.
3. **Copy what you need**: Take the range for tools that want `start - end`, the wildcard for Cisco-style ACLs, or the count for capacity planning.

> **In an AI assistant** Connect the LookupOwl MCP server and ask: “A vendor gave us 198.51.100.0/23. What range is that?” The assistant calls `ip_range_convert` and gets `198.51.100.0` to `198.51.101.255`, the 512-address count, the netmask and the wildcard mask. Paste a whole list of blocks from a firewall export and it converts them in one call.

### Range versus usable hosts

The range includes every address in the block, the network address (first) and the broadcast address (last) too. That is the right view for allow-lists and routing rules, where the whole block is covered. It is not the host range. For the first and last usable host, use the [subnet calculator](https://lookupowl.com/subnet-calculator).

- **Host bits set.** `192.168.1.77/24` is accepted. The result shows `192.168.1.0/24` and tells you the address was rounded down to the start of its block.
- **Netmask and wildcard.** The netmask has ones for the network part, so for `/26` it is `255.255.255.192`. The wildcard mask is the reverse, with ones for the host part, so it is `0.0.0.63`.
- **Count.** The size is 2 to the power of `32 - prefix`, so a `/22` has 2^10 = 1,024 addresses.

### Common errors

- **Prefix out of range.** IPv4 prefixes run from `/0` to `/32`. `/33` is rejected.
- **Leading zeros.** `010.0.0.1` is ambiguous, because some software reads it as octal, so it is rejected. The message shows both readings.
- **A range instead of a block.** `10.0.0.1 - 10.0.0.9` is not a CIDR block. This page rejects it and points you to [IP range to CIDR](https://lookupowl.com/ip-range-to-cidr).
- **An IPv6 block.** Lines from the other IP family are reported as errors, line by line. Use [IPv6 CIDR to range](https://lookupowl.com/ipv6-cidr-to-range) for those.
- **Spaces in the block.** These are forgiven: `10.0.0.0 / 8` and `10.0.0.0 255.0.0.0` are both read as `10.0.0.0/8`.
- **A mask instead of a prefix.** `10.0.0.0/255.0.0.0` is read as `10.0.0.0/8`, and a wildcard such as `0.255.255.255` is understood too, with a note in the result. A value that is neither a valid netmask nor a valid wildcard, such as `255.0.1.0`, is rejected. The [subnet calculator](https://lookupowl.com/subnet-calculator) shows the prefix and wildcard for any mask.

### How it works

The address is read as a 32-bit integer. The mask is that many leading ones, the first address is the integer ANDed with the mask, and the last is the first ORed with the inverted mask. Counts are whole numbers, never rounded. The conversion runs on our server from the text you submit. It is not written to logs and is held in memory for at most a day. On the website, Google Analytics also records what you enter, as the [privacy policy](https://lookupowl.com/privacy) explains.

```bash
# The same maths in Python, for checking
python3 -c "import ipaddress as i; n=i.ip_network('10.0.0.0/22'); print(n[0], n[-1], n.num_addresses)"
```

The standards behind it are **RFC 4632** (CIDR, which replaced classful addressing), **RFC 950** (subnetting) and **RFC 1519**, the 1993 original that RFC 4632 superseded.

### Frequently asked questions

**How do I convert CIDR to an IP range?**

Keep the leading bits fixed, then set all the remaining bits to 0 for the first address and to 1 for the last. For a `/24` the last number runs from 0 to 255. Paste the block above and the tool does this for any prefix length, along with the count and the masks.

**What does 192.168.1.0/24 cover?**

It covers 192.168.1.0 through 192.168.1.255, which is 256 addresses, because 24 bits are fixed and the last 8 can take any value. On a normal subnet 254 of them are usable hosts, because the first is the network address and the last is the broadcast address.

**Why do some tools show a different last address?**

Some tools report the last usable host (`.254`) instead of the last address in the block (`.255`). Both are correct, because they answer different questions. This page shows the real edges of the block, which is what allow-lists and routing rules match on. For the host range, use the [subnet calculator](https://lookupowl.com/subnet-calculator).

**Can I convert many blocks at once?**

Yes, up to 1,000 lines in one go. You can mix valid and invalid lines, and each error is reported against its own line, so one typo does not hide the rest. Lines past 1,000 are left out, and the JSON result shows `truncated: true`.

**Can I enter an IP range here?**

No, this page only takes CIDR blocks. A range such as `10.0.0.1 - 10.0.0.9` gets an error that points to [IP range to CIDR](https://lookupowl.com/ip-range-to-cidr). That page turns a start and end address into the fewest blocks that cover it exactly, which is often more than one.

**Does it support IPv6?**

Yes, on its own page: [IPv6 CIDR to range](https://lookupowl.com/ipv6-cidr-to-range). The idea is the same, but with 128-bit numbers, so the counts are much larger and are shown exactly. An IPv6 block pasted here is reported as an error that points to that page.
