What is an IP range to CIDR converter?
An IP range to CIDR converter expresses a span of IPv4 addresses, from a start address to an end address, as the smallest set of CIDR blocks that covers it exactly. Many systems only accept CIDR notation, including firewalls, AWS and Azure security rules, nginx and web application firewalls.
Enter one range per line and get its blocks, with the number of addresses and blocks needed. Enter a CIDR block instead and it's expanded the other way, to its first and last address and size. Mixed lists are fine, and the result can be copied or downloaded as text.
How to use the IP range to CIDR
1.Enter ranges or blocks
One per line: 10.0.0.5 - 10.0.0.20, or 172.16.0.0/22.
2.Read the result
Each range becomes CIDR blocks; each block becomes a range.
3.Copy or download
Paste the list into your firewall or config.
Example: an odd-sized range
Allowing 10.0.0.5 to 10.0.0.20 (16 addresses) through a firewall:
- Blocks
- 10.0.0.5/32, 10.0.0.6/31, 10.0.0.8/29, 10.0.0.16/30, 10.0.0.20/32
- Check
- 1 + 2 + 8 + 4 + 1 = 16 addresses
- Reverse
- 172.16.0.0/22 → 172.16.0.0 – 172.16.3.255
Five rules cover the range exactly, with no address left out or let in by mistake.
Why one range can need several blocks
A CIDR block must start on a boundary that matches its size: a /29 always begins at a multiple of 8. A range that starts or ends between boundaries is covered by a sequence of blocks, largest possible first, with no gaps and no extra addresses.
That's why 10.0.0.5 to 10.0.0.20 takes five blocks, while 192.168.1.0 to 192.168.1.255 is exactly one /24. Lines starting with # are treated as comments and ignored.
Frequently asked questions
Will the blocks include addresses outside my range?
No. They cover the range exactly.
Can I paste many ranges at once?
Yes, one per line. Each gets its own heading in the result.
Which separators work between start and end?
A hyphen, en dash, the word to, a comma or a space.
Does it handle IPv6?
Not yet; it's for IPv4 ranges.
Related tools
Subnet calculator
Network, broadcast, host range and mask for any IPv4 address and prefix.
Subnet splitter
Divide a CIDR block into smaller subnets by count, hosts or prefix.
IP address converter
Convert IPv4 addresses between dotted, integer, hex, binary and IPv6 forms.
IPv6 calculator
Expand, compress and classify IPv6 addresses and work out prefix ranges.
chmod calculator
Convert Unix file permissions between octal like 755 and symbolic like rwxr-xr-x.
JSON Formatter & Validator
Pretty-print, minify, sort and validate JSON with line-numbered errors.
More Developer tools
JSON & data
CSV tools
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- HTML entity encoder
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table