redzilla
All tools
Diagnostics

CIDR to Regex & Range

Paste a CIDR subnet and I generate a regular expression matching exactly its IPs, the range (first–last), the total and examples. Great for grep on logs, ACLs and rules.

IPv4 with prefix, e.g. 192.168.1.0/24 or 10.0.0.0/8.

Examples
redzilla.cl — cidr2regex
 

Regular expression

Anchored with ^…$ and dots escaped. Use it in grep -E, egrep or log filters.

First
Last
Mask
Prefix
/24
255.255.255.0
Addresses
256
254 usable hosts
Range
192.168.1.0
— 192.168.1.255

Tested examples

IPMatches?Note

Checked against the regex itself in your browser.

How to use it · grep, ACLs and filters

Runs locally in your browser · no sign-up · nothing leaves your browser

Was this tool useful?
Disclaimer We take great care to keep every tool accurate and review it thoroughly; even so, we can't guarantee it is free of errors or take responsibility for how the results are used. We recommend double-checking anything critical.
Found an error? Let us know →