CIDR Validator
Check whether text is a valid IPv4 or IPv6 address range in CIDR notation as you type it, right in your browser.
Input
Output
No value
Guide
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation writes a block of IP addresses as an address, a slash and a prefix length, such as 192.0.2.0/24. The prefix length says how many bits at the start are the same for every address in the block. An IPv4 address has 32 bits, so /24 leaves 8 bits free, and the block holds 256 addresses, from 192.0.2.0 to 192.0.2.255. IPv6 works the same way with 128 bits, as in 2001:db8::/32. The bigger the prefix, the smaller the block: /32 in IPv4 and /128 in IPv6 stand for a single address.
You meet CIDR ranges in firewall rules, cloud security groups, router, VPN and Docker settings, and allow lists for an admin page. Checking a range before you save it catches a typo that could lock you out or let too many in.
Tool description
Type or paste a range into the CIDR field, and the result shows as you type: "CIDR is valid" or "CIDR is not valid". Spaces and line breaks around a pasted range are ignored.
The IP version menu sets which ranges pass. It starts on Any, which accepts both versions, while IPv4 and IPv6 accept only that one.
What passes and what fails
- An IPv4 address with a prefix from 0 to 32 passes:
192.0.2.0/24,198.51.100.0/22,203.0.113.7/32 - An IPv6 address with a prefix from 0 to 128 passes:
2001:db8::/32,2001:db8:1234::/48 - The address follows the rules of the IP Address Validator, so IPv6 addresses may be shortened with
::, while192.0.02.0/24fails for its leading zero - A missing prefix fails (
192.0.2.0), and so does one too large for the version:192.0.2.0/33,2001:db8::/129 - A prefix with a leading zero or a sign fails:
/024,/+24 - A subnet mask in place of the prefix fails (
192.0.2.0/255.255.255.0), and so do spaces around the slash and ranges written with a hyphen, such as192.0.2.0-192.0.2.255
Good to know
- The address doesn't have to be the first one of its block:
192.0.2.77/24passes as well as192.0.2.0/24. Some routers and firewalls want the network address itself, which the Subnet calculator works out for IPv4 ranges. - A prefix of 0 covers every address: firewall rules use
0.0.0.0/0and::/0for traffic from anywhere. - The check looks at the form only, so it can't tell whether a range is in use or who it belongs to.
Features
- Checks IPv4 and IPv6 ranges in CIDR notation
- Checks that the prefix fits the address's version
- A setting to accept only IPv4 or only IPv6
- Results as you type, with no button to press
- Runs in your browser, so nothing you type is sent anywhere