Range to CIDR
Range to CIDR turns an IP range into the smallest set of CIDR blocks that covers exactly that range, or merges a list of CIDR blocks into fewer routes — IPv4 and IPv6, exact integer math, entirely in your browser.
How to Use
- 1
Pick IPv4 or IPv6 at the top, then choose a mode. IP range → CIDR converts a start–end range into the minimal CIDR list; Summarise CIDRs merges a list of CIDR blocks into fewer routes.
- 2
For a range, enter the start and end addresses — both endpoints are included. Try the presets: 192.168.0.0–192.168.0.255 gives a single 192.168.0.0/24, and 10.0.0.0–10.0.0.7 gives 10.0.0.0/29.
- 3
For summarising, paste one CIDR per line (commas work too) — for example 192.168.0.0/25 and 192.168.0.128/25, which merge into a single 192.168.0.0/24.
- 4
Read the result table: each CIDR block, how many addresses it covers, and the total address count. In Summarise mode a badge says how many input blocks were merged away.
- 5
Copy one block with its Copy button, or copy the whole list with Copy list and paste it into a firewall rule, a router config, or a cloud security group.
- 6
Check the list before applying it: the blocks are minimal, so removing any one leaves a hole in the range. Summarising covers exactly the same addresses with fewer routes — but it cannot tell you whether a route is wanted, only that it covers the same addresses.
Frequently Asked Questions
What is a minimal CIDR list?
Why does my range need more than one CIDR block?
What does route summarisation (CIDR aggregation) do?
Does it support IPv6?
What happens to host bits in a CIDR I paste?
Which blocks merge and which stay separate?
Can I use the output in a firewall or router?
How is this different from the Subnet Calculator?
Is my IP range uploaded anywhere?
What can go wrong?
Generative Answer & AI Documentation
What is the Range to CIDR?
Range to CIDR has two modes. IP range → CIDR takes a start address and an end address — both endpoints included — and returns the minimal CIDR list: the smallest set of CIDR blocks whose union is exactly the range, no more addresses and no fewer. A range that lines up with a block boundary becomes one block: 192.168.0.0 to 192.168.0.255 is 192.168.0.0/24, and 10.0.0.0 to 10.0.0.7 is 10.0.0.0/29. A range that does not line up is split into the fewest aligned blocks that fit: 192.168.1.0 to 192.168.1.130 becomes 192.168.1.0/25, 192.168.1.128/31 and 192.168.1.130/32. Summarise CIDRs takes a list of CIDR blocks — one per line, or separated by commas — and returns a shorter list covering exactly the same addresses: overlapping blocks are dropped, blocks already covered by a larger block are dropped, and directly adjacent blocks that form one larger aligned block are merged (192.168.0.0/25 plus 192.168.0.128/25 becomes 192.168.0.0/24). Host bits in pasted blocks are ignored, so 192.168.0.5/24 is read as 192.168.0.0/24. Both modes work for IPv6 with exact BigInt arithmetic: 2001:db8:: to 2001:db8::ffff is 2001:db8::/112. Every result shows each block, how many addresses it covers, and the total address count, with a Copy button per block and a Copy list button for the whole list.
Why use Range to CIDR offline?
Firewalls, routers, cloud security groups and route tables do not take ranges — they take CIDR blocks. The gap between 'allow 192.168.1.0 to 192.168.1.130' and the list of blocks a firewall accepts is exactly what this page closes, and it is a gap people usually close by hand, by guessing, or by asking an AI. Guessing produces the two classic errors: a block that is too wide, silently allowing addresses outside the range, or a block that is too narrow, silently dropping addresses inside it. An AI's answer has the same failure mode with more confidence. The deterministic answer is a short, exact computation — the largest aligned block that fits at the current address, repeated until the range is covered — and it is the same computation whether it runs on a server or in a tab. Running it in the tab matters because of what people paste into these tools: real internal ranges, 10.x networks, VPC CIDRs, the layout of a network they do not want to hand to a stranger. Here the range never leaves the browser, which is the only privacy claim the page needs to make, and the result is checkable on sight: the blocks are listed with their sizes, and the total address count must equal the size of the range you typed.
When should you use this tool?
Use it when a firewall rule, a security group, or an ACL needs the CIDR form of an address range; when a route table has grown to dozens of overlapping entries and needs summarising into fewer routes; when two teams hand you two lists of allowed ranges and you need one clean list; when a cloud migration asks for the CIDR blocks behind a range in a spreadsheet; and when you are studying CIDR and want to see why a range splits the way it does — the presets are chosen to show the three cases (one block, an aligned split, an unaligned split). Use the Subnet Calculator instead when you need to understand one network: its network and broadcast addresses, first and last usable host, and how it splits into subnets. Do not use the output as a decision about whether a range should be allowed or blocked, or whether it is routable on the internet — this page only does the address math, and routability depends on your ISP and routing, not on the addresses.
Key Benefits
- Minimal CIDR lists: the smallest set of blocks covering exactly the range — removing any block leaves a hole, adding any address needs a new block.
- Route summarisation that drops overlaps and covered blocks and merges adjacent blocks, with a badge saying how many input blocks were merged away.
- Real IPv6 support with exact BigInt arithmetic — no floating-point rounding on 128-bit addresses.
- Every block shown with its address count, plus the total count, so the result is checkable against the range you typed.
- Host bits ignored on input: 192.168.0.5/24 is read as its network, 192.168.0.0/24, and the result shows what was actually used.
- Copy per block or copy the whole list, ready to paste into a firewall rule, a router config, or a security group.
- 100% private: real internal ranges never leave the tab, no signup, no limits, works offline once loaded.
Common Use Cases
- Writing a firewall rule: the range 192.168.0.0–192.168.0.255 becomes one line, 192.168.0.0/24, to paste into the rule. The range 192.168.1.0–192.168.1.130 becomes three lines — 192.168.1.0/25, 192.168.1.128/31, 192.168.1.130/32 — and the table shows the three blocks cover 131 addresses, exactly the range.
- Cleaning a route table: a list of 192.168.0.0/25, 192.168.0.128/25, 10.0.0.0/24 and 10.0.0.128/25 summarises to two routes, 192.168.0.0/24 and 10.0.0.0/24 — the /25s merge, the covered /25 is dropped, and the badge reports 2 input blocks merged away.
- Sizing a VPC allow-list: an allow-list written as a range in a spreadsheet becomes the exact CIDR list for the security group, with no address accidentally added or dropped at either end.
- Checking an AI's answer: an AI that claims 10.0.0.0–10.0.0.7 is 10.0.0.0/28 is wrong — /28 covers 16 addresses, 10.0.0.0–10.0.0.15. The correct minimal list is 10.0.0.0/29, and the page shows it with the address count to prove it.
- Learning CIDR: the presets walk the three cases — 192.168.0.0–192.168.0.255 (one block), 10.0.0.0–10.0.0.7 (one small block), and 192.168.1.0–192.168.1.130 (an unaligned range that needs three blocks).
Developer Notes & Best Practices
The range algorithm is the standard one: while addresses remain, take the largest block that is both aligned at the current address and no bigger than the remaining range. Alignment comes from the lowest set bit of the current address — a block starting at an address that is a multiple of its size — and the remaining size caps the block. A single address is always a /32 (IPv4) or /128 (IPv6). Summarising works by converting every input block to a [start, end] interval, sorting, merging intervals that overlap or touch, and converting each merged interval back to its minimal CIDR list — which is why two adjacent /25s become one /24, while two /25s with a gap between them stay separate: merging across the gap would add addresses that were not in the input. IPv6 uses BigInt throughout, so 128-bit arithmetic is exact; the address count is reported as a plain number and clamps at Number.MAX_SAFE_INTEGER for ranges larger than about 9 quadrillion addresses, in which case the page says so rather than printing a wrong count. Input parsing is strict about shape — each octet 0–255, prefix 0–32 for IPv4 and 0–128 for IPv6 — and the error messages name the offending value. The one deliberate leniency is host bits: a pasted block is read as its network address, because that is what the block means.
Worked examples — range to minimal CIDR list
| Range | Minimal CIDR list | Addresses |
|---|---|---|
| 192.168.0.0 – 192.168.0.255 | 192.168.0.0/24 | 256 |
| 10.0.0.0 – 10.0.0.7 | 10.0.0.0/29 | 8 |
| 192.168.1.0 – 192.168.1.130 | 192.168.1.0/25, 192.168.1.128/31, 192.168.1.130/32 | 131 |
| 10.0.0.5 – 10.0.0.5 | 10.0.0.5/32 | 1 |
| 0.0.0.0 – 255.255.255.255 | 0.0.0.0/0 | 4,294,967,296 |
| 2001:db8:: – 2001:db8::ffff | 2001:db8::/112 | 65,536 |
Worked examples — summarising CIDR lists
| Input | Summarised | What happened |
|---|---|---|
| 192.168.0.0/25, 192.168.0.128/25 | 192.168.0.0/24 | Adjacent blocks merged into one larger block. |
| 10.0.0.0/24, 10.0.0.128/25 | 10.0.0.0/24 | The /25 is already inside the /24, so it is dropped. |
| 10.0.0.0/25, 10.0.1.0/25 | 10.0.0.0/25, 10.0.1.0/25 | Not adjacent — merging would add addresses not in the input. |
| 192.168.0.0/24, 192.168.0.0/24 | 192.168.0.0/24 | Duplicate dropped. |
| 2001:db8::/127, 2001:db8::2/127 | 2001:db8::/126 | Adjacent IPv6 blocks merged. |
Why a range needs more than one block
| Range | Blocks | Reason |
|---|---|---|
| 192.168.0.0 – 192.168.0.255 | 1 | Start and end sit on a /24 boundary. |
| 10.0.0.0 – 10.0.0.7 | 1 | Start is a multiple of 8 and the range is exactly 8 addresses. |
| 192.168.1.0 – 192.168.1.130 | 3 | The end, 130, is not on a block boundary, so the tail splits. |
| 192.168.1.64 – 192.168.1.127 | 1 | An aligned quarter: 192.168.1.64/26. |
| 10.1.2.3 – 10.1.9.200 | Several | Neither endpoint is aligned; the list is still minimal and exact. |
- Confirm the endpoints before applying the list: a range off by one address at either end produces a different minimal list.
- Check the total address count against the range you typed — it must equal the size of the range (end minus start, plus one).
- Copy the list, not a single block, when the range needs several blocks — one block alone leaves a hole.
- Keep the original list until summarised routes are tested: summarising covers exactly the same addresses, but it cannot tell you whether a route is wanted.
- Remember host bits are ignored on input — if you paste 192.168.0.5/24, the network used is 192.168.0.0/24, and the result table shows that.
- For IPv6, sanity-check the prefix: a /112 is 65,536 addresses, and a typo'd prefix changes the count by orders of magnitude.
Common Mistakes
- Swapping start and end: the page errors and tells you to swap them, but a range typed backwards in a spreadsheet will not error there — check the order before pasting.
- Using one block from a multi-block list: the list is minimal, so each block covers part of the range and dropping one leaves a hole.
- Assuming adjacent always merges: two blocks merge only when they are adjacent and together form one larger block on an aligned boundary — 10.0.0.0/25 and 10.0.1.0/25 stay separate.
- Forgetting host bits are ignored: 192.168.0.5/24 means the network 192.168.0.0/24, not the single host 192.168.0.5 — use a /32 when you mean one address.
- Trusting an AI's CIDR list without checking it: a confident list that is off by one block is the common failure, and the address-count column is the check.
- Treating the output as a routing decision: the page proves the blocks cover the range, not that the range should be allowed, blocked, or advertised.
Limitations
This page does CIDR address math and nothing else. It cannot tell you whether a range is routable on the internet — it classifies nothing and checks no routing table — and it cannot tell you whether a route should be allowed or blocked; that is a policy decision, not an arithmetic one. It does not check whether the addresses are in use, whether they overlap with a range you forgot to paste, or whether a firewall will accept the list — those depend on your network and your device. The minimal list is exact for the range you typed, so a typo'd endpoint gives an exact answer to the wrong question; the total address count is there so you can catch that. IPv6 address counts clamp at Number.MAX_SAFE_INTEGER for ranges larger than about 9 quadrillion addresses, and the page says so instead of printing a wrong number.
Structured Input/Output Example
192.168.1.0 to 192.168.1.130
192.168.1.0/25 (128 addresses) 192.168.1.128/31 (2 addresses) 192.168.1.130/32 (1 address) Total: 3 blocks, 131 addresses
Related Tools
Subnet Calculator
Subnet calculator: IPv4 and IPv6 CIDR math — network, broadcast, first/last host, usable hosts, split into subnets, VLSM, and an AI-answer check.
Unix Timestamp Converter
Unix timestamp converter: turn epoch seconds or milliseconds into local time, UTC, and relative times. Auto-detects seconds vs milliseconds.
Cron Expression Generator
Cron expression generator: build a valid 5-field crontab line from dropdowns, with a plain-English translation to verify the schedule before it runs.
Regex Tester
Regex tester: debug regular expressions with live match highlighting, match counts, and instant syntax feedback. Flags g, i, m, s supported.