🌐IPv4 Range → CIDR Blocks & Subnet Tester Documentation & Guide
📋How to Convert IP Ranges Into CIDRs
- Enter Start & End IPv4: Specify inclusive start IPv4, end IPv4, and optionally a single test IP to check.
- Compute Minimal CIDR Set: Click Compute CIDRs to run greedy largest-aligned power-of-2 block decomposition.
- Copy ACL Rules: Inspect total covered IP count, range match badge, and copy clean CIDR notation.
⚙️Unsigned 32-Bit Power-of-2 Prefix Alignment Decomposition▼
Converts IPv4 octets to unsigned 32-bit integers (`>>> 0`), repeatedly extracts the largest aligned `2^k` block divisible at the current cursor that still finishes on or before `endIp`, guaranteeing the mathematically minimal CIDR cover.
📐Formula & Mathematical Architecture▼
🧮Concrete Worked Examples▼
192.168.1.10 to 192.168.1.50 (Test: 192.168.1.33)5 minimal CIDRs (/31, /30, /28, /28, /30, /32 — exact 41 IPs) | Match: IN RANGE ✓Power-of-2 alignment breaks non-subnet boundaries cleanly without leaking neighboring hosts.
10.0.0.0 to 10.0.1.255Single block: 10.0.0.0/23 (512 IPs)When aligned on a 512-address boundary, the entire range collapses to one /23 CIDR.
⚠️Common Pitfalls & Edge Cases▼
- ⚠️Rounding partial vendor IP ranges lazily up to `/24`, accidentally allowlisting 200 unrelated public hosts!
- ⚠️Reversing Start IP and End IP order.
- ⚠️Using signed 32-bit bitshifts in JavaScript without `>>> 0` on high IPs (`>= 128.0.0.0`).
💡Cloud Security Groups & Firewalls▼
- Translating ISP/vendor dash-separated IP ranges (`10.20.0.10 - 10.20.0.50`) into AWS Security Group or Cloudflare WAF CIDR rules.
- Auditing whether a client IP sits inside an approved IP allowlist window.