IP List β Ranges
Compress consecutive IPs into ranges
Input IP Addresses
Consolidated Ranges
IP ranges will appear here
The IP List to Ranges tool compresses a list of individual IP addresses into compact ranges by identifying consecutive sequences. Paste a list of IPs like 192.168.1.1, 192.168.1.2, 192.168.1.3, 192.168.1.10, 192.168.1.50 and get back 192.168.1.1-192.168.1.3, 192.168.1.10, 192.168.1.50 -- dramatically reducing list size for easier storage, review, and processing.
Understanding IP List Compression
Anyone who has worked with security logs, network scan results, or threat intelligence feeds knows the pain of managing long lists of individual IP addresses. An Nmap scan of a /24 subnet returns 256 lines of output. A firewall log export might contain thousands of source IPs. A blocklist feed from a threat intelligence provider delivers addresses one per line, often with large consecutive runs mixed with scattered individual entries. These lists are unwieldy to read, expensive to store, and slow to process.
Range compression solves this problem by recognizing patterns that humans would spot immediately but that raw text obscures. When you see 10.0.0.1 through 10.0.0.254 listed on 254 separate lines, you know instinctively that this is one contiguous block. The tool does the same thing programmatically: it sorts the addresses numerically, scans for consecutive runs, and expresses each run as a single range entry using start-end notation. A list of 1,000 consecutive IPs becomes 10.0.0.1-10.0.3.232 -- one line instead of a thousand.
The key distinction from CIDR compression is flexibility. CIDR notation requires power-of-two alignment, so expressing 192.168.1.1 through 192.168.1.5 as CIDRs requires three blocks (192.168.1.1/32, 192.168.1.2/31, 192.168.1.4/31). Range notation handles the same five addresses as a single 192.168.1.1-192.168.1.5 entry. Use ranges when your downstream tool accepts start-end notation, and use the IP Range to CIDR Converter when you specifically need CIDR output.
How to Compress an IP List into Ranges
- Paste your list of individual IP addresses in any format -- one per line, comma-separated, or space-separated
- Optionally set a minimum run length (e.g., 3) so very short consecutive sequences stay as individual entries
- Click compress to identify all consecutive runs
- Review the output showing ranges in start-end notation with address counts
- Copy the compressed list for use in firewall configurations, reports, or security tools
IP List Compression Examples
Basic consecutive IP compression
Input:
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
192.168.1.5
192.168.1.10
192.168.1.11
192.168.1.12
192.168.1.50
Output:
| Entry | Type | Count |
|---|---|---|
192.168.1.1-192.168.1.5 | Range | 5 |
192.168.1.10-192.168.1.12 | Range | 3 |
192.168.1.50 | Individual | 1 |
Compression: 9 entries reduced to 3 (66.7% reduction)
Large scan result compression
Input: 256 IPs from 10.0.0.0 through 10.0.0.255
Output: 10.0.0.0-10.0.0.255 (1 range, 256 addresses)
Compression: 256 entries to 1 (99.6% reduction)
Mixed consecutive and scattered IPs
Input:
172.16.0.1, 172.16.0.2, 172.16.0.3
172.16.0.100
172.16.0.200, 172.16.0.201
172.16.1.1, 172.16.1.2, 172.16.1.3, 172.16.1.4
Output:
| Entry | Count |
|---|---|
172.16.0.1-172.16.0.3 | 3 |
172.16.0.100 | 1 |
172.16.0.200-172.16.0.201 | 2 |
172.16.1.1-172.16.1.4 | 4 |
When to Use IP List to Ranges Compression
- Security scan results -- compress Nmap or Masscan output listing discovered hosts into readable ranges
- Threat intelligence feeds -- condense IP blocklists from feeds that deliver individual addresses into compact range notation
- Log analysis -- summarize lists of source IPs extracted from web server or firewall logs
- Network inventory -- compress DHCP lease exports or ARP table dumps into range summaries for capacity reporting
- Firewall rule preparation -- convert raw IP lists into range format accepted by firewalls that support start-end notation
- Incident response reporting -- present affected IP ranges in a clear, concise format for management reports
How IP List to Range Compression Works
Sorting
The algorithm first sorts all input IP addresses numerically. IPv4 addresses are converted to their 32-bit integer equivalents for comparison. 10.0.0.1 becomes 167772161, 10.0.0.2 becomes 167772162, and so on. This ensures consecutive addresses are adjacent in the sorted order regardless of input format.
Run Detection
The sorted list is scanned sequentially. For each pair of adjacent IPs, the algorithm checks whether the second IP equals the first IP plus one. If so, they belong to the same consecutive run. The run extends as long as each next IP is exactly one greater than the previous.
Range Formation
Each run of two or more consecutive IPs becomes a range expressed as start-end. Single IPs that are not part of any run remain as individual entries. The minimum run length option controls the threshold -- setting it to 3 means pairs of two consecutive IPs stay as separate entries.
Statistics
The output includes the total number of input IPs, the number of output entries (ranges + individuals), the compression ratio, and the largest and smallest ranges found. These statistics help assess how compressible the data is and whether the source list has structural patterns.
Practical Tips for IP List Management
When working with large IP lists from multiple sources, always deduplicate before compressing. Duplicate entries inflate the apparent size of your list and can make the compression ratio look more impressive than it actually is. The tool handles duplicates automatically, but knowing how many you had helps you assess the quality of your input data. If a blocklist feed delivers 10,000 IPs but 3,000 are duplicates, that tells you something about the feed's curation quality.
The minimum run length setting is more useful than it first appears. Setting it to 1 (the default) means even two adjacent IPs become a range. This produces the most compact output but can make the result harder to read when you have many tiny ranges intermixed with individual addresses. Setting it to 3 or 4 keeps short runs as individual entries, which can be easier to scan visually when you are looking for specific addresses in the output.
If you need to go from ranges back to individual IPs (for example, to feed a tool that only accepts one IP per line), use the Range List to IP List tool. The two tools are complementary: compress for storage and human review, expand when a downstream tool needs individual addresses.
Frequently Asked Questions
What input formats are accepted?
The tool accepts IPs in virtually any text format: one per line, comma-separated, space-separated, tab-separated, or any combination. It extracts valid IPv4 addresses from the input and ignores non-IP text, making it easy to paste directly from logs, spreadsheets, or command output.
How does this differ from converting IPs to CIDR blocks?
Range notation (192.168.1.1-192.168.1.5) can express any consecutive sequence regardless of alignment. CIDR notation requires power-of-two alignment, so the same five IPs would need multiple CIDR blocks (192.168.1.1/32, 192.168.1.2/31, 192.168.1.4/31). Use ranges when the consumer accepts start-end notation; use the IP Range to CIDR Converter when you need CIDR output.
Are duplicate IPs handled?
Yes. Duplicate IPs are removed before compression. If 10.0.0.1 appears five times in your input, it is counted once. The tool reports how many duplicates were removed.
Does this work with IPv6 addresses?
Yes. IPv6 addresses are sorted by their 128-bit integer value and compressed into ranges the same way. IPv4 and IPv6 addresses are processed and displayed separately in the output.
What is the maximum list size the tool can handle?
The tool processes lists of tens of thousands of IPs efficiently in the browser. Very large lists (hundreds of thousands of addresses) may take a few seconds to sort and scan but will still complete without issues. All processing happens client-side, so no data is sent to a server.
Related Tools
- Range List to IP List - Expand IP ranges back to individual IPs
- IP Range to CIDR Converter - Convert IP ranges to minimal CIDR blocks
- CIDR Aggregator - Aggregate multiple CIDR blocks into summarized routes
- Extract IPs from Text - Extract IP addresses from logs or text snippets
- CIDR to IP Range Converter - Convert CIDR notation to IP address range