Skip to main content
IP Range CalculatorPRO
IPv4 Subnetting & RangeInstant Client-Side Tool

CIDR Validator

Check address and prefix syntax.

CIDR Validator: inputs and results

Enter an IP address, CIDR prefix, or range. Then check its first and last address below.

Quick presets:

Calculated Boundaries & ParametersReady

Network Address192.168.1.0
Broadcast Address192.168.1.255
First Usable Host192.168.1.1
Last Usable Host192.168.1.254
Subnet Mask255.255.255.0
Wildcard Mask0.0.0.255
Total Addresses256
Usable Host Range254

How CIDR Validator Works?

The CIDR Validator works by running 5 checks on each entry: address format, octet range, prefix range, leading zeros, and boundary alignment. Each entry receives a Valid, Valid-not-aligned, or Invalid result.

  1. Split the address and prefix

    The validator splits 172.20.0.0/12 at the slash into an address part and a prefix part.

  2. Check the 4 octets

    Each octet must be a decimal number from 0 to 255 without leading zeros. 256 and 010 both fail.

  3. Check the prefix

    The prefix must be a whole number from 0 to 32.

  4. Check alignment

    The validator compares the address with address AND mask. A mismatch means host bits are set, and the tool reports the aligned network.

CIDR Validator Formula

The CIDR Validator formula is Valid = (4 octets in 0–255) AND (0 ≤ p ≤ 32), and Aligned = (IP AND Mask) = IP.

Octet rule

0 ≤ octet ≤ 255

Applied to all 4 octets.

Prefix rule

0 ≤ p ≤ 32

IPv4 has 32 bits.

Alignment rule

(IP AND Mask) = IP

True only when every host bit is 0.

Host bit test

(IP AND Wildcard) = 0

An equivalent form of the alignment rule.

Worked example: 172.20.0.0/12

Octets 172, 20, 0, 0  → all within 0–255 ✓
Prefix 12             → within 0–32 ✓
Mask   255.240.0.0    → 20 AND 240 = 16
IP AND Mask = 172.16.0.0 ≠ 172.20.0.0
Result: valid syntax, not aligned → use 172.16.0.0/12

CIDR Validator Conversion Table

The CIDR Validator conversion table shows the result for 12 sample inputs, covering valid blocks, unaligned blocks, and 5 common syntax errors.

InputResultReason
192.168.1.0/24ValidAligned to the prefix boundary
192.168.1.10/24Valid, not alignedNetwork is 192.168.1.0/24
172.16.0.0/12ValidAligned to the prefix boundary
172.20.0.0/12Valid, not alignedNetwork is 172.16.0.0/12
10.0.0.0/8ValidAligned to the prefix boundary
10.0.0.0/33InvalidPrefix above /32
256.1.1.0/24InvalidOctet above 255
10.0.0/8InvalidNot in a.b.c.d/p form
192.168.010.0/24InvalidLeading zero in an octet
0.0.0.0/0ValidAligned to the prefix boundary
203.0.113.64/26ValidAligned to the prefix boundary
203.0.113.70/26Valid, not alignedNetwork is 203.0.113.64/26

What is CIDR Validator?

The CIDR Validator is a tool that checks whether an IPv4 CIDR entry has correct syntax and whether its address sits on the prefix boundary.

CIDR notation joins an address and a prefix length with a slash, as in 192.168.1.0/24. Syntax errors break configuration imports, and unaligned entries such as 192.168.1.10/24 behave differently across platforms. Linux ip route rejects some of them, while other systems silently round the address down.

The CIDR Validator separates the 2 problems. A syntax error makes an entry unusable. An alignment issue makes the entry usable but ambiguous, so the validator prints the aligned network to use instead.

What are the uses of CIDR Validator?

There are 5 main uses of the CIDR Validator, including input sanitizing, configuration review, and bulk list cleanup.

  • Sanitizing form inputs

    Web forms that accept network ranges check entries before saving, which stops values such as 10.0.0.0/33.

  • Reviewing infrastructure code

    Terraform and Ansible files hold dozens of CIDR strings. The validator catches unaligned blocks before terraform apply.

  • Cleaning allow-lists

    Allow-lists copied from emails and tickets contain typos. The validator flags each broken line.

  • Checking routing announcements

    BGP prefix filters require aligned prefixes. The validator confirms alignment before an announcement goes live.

  • Grading student answers

    Instructors check whether a student wrote a valid, aligned network for a given prefix.