Calculator: IPv4 range to CIDR blocks

Enter the labelled inputs to calculate: Count; Result; Count NIP.

Count
1
Result
192.168.1.0/24
Count NIP
256

How the calculation works

∪CIDRᵢ=[A,B]; CIDRᵢ∩CIDRⱼ=∅

IPv4 uses strict dotted decimal. IPv6 accepts embedded IPv4 tails and compresses the longest leftmost zero run. Zone identifiers are excluded. Prefix tools describe address ranges, not routability or host allocation policy.

Values must satisfy the formula’s domain. Nonzero results too small or too large for reliable representation are rejected.

Frequently asked questions

How is the result calculated?

∪CIDRᵢ=[A,B]; CIDRᵢ∩CIDRⱼ=∅

What assumptions apply?

IPv4 uses strict dotted decimal. IPv6 accepts embedded IPv4 tails and compresses the longest leftmost zero run. Zone identifiers are excluded. Prefix tools describe address ranges, not routability or host allocation policy.

How precise are the displayed results?

Numerical results show up to ten significant digits. Rounding does not improve the accuracy of the input measurements or the model. Values must satisfy the formula’s domain. Nonzero results too small or too large for reliable representation are rejected.

How we verified this calculator

The calculator is checked against 3 reference cases computed independently from the sources below. Last passed: .

# Inputs Expected result
1
Address A = 192.168.0.0
Address B = 192.168.0.255
Count: 1
Result: 192.168.0.0/24
Count NIP: 256
2
Address A = 10.0.0.5
Address B = 10.0.0.20
Count: 5
Result: 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
Count NIP: 16
3
Address A = 192.168.1.100
Address B = 192.168.1.200
Count: 6
Result: 192.168.1.100/30; 192.168.1.104/29; 192.168.1.112/28; 192.168.1.128/26; 192.168.1.192/29; 192.168.1.200/32
Count NIP: 101

Sources

How we test our calculators →

Also try:

Back to category →