Calculator: Minimal covering IPv4 prefix

Enter the labelled inputs to calculate: Result CIDR; First address; Last address; Count.

Result CIDR
192.168.1.0/24
First address
192.168.1.0
Last address
192.168.1.255
Count
256

How the calculation works

p=32−⌈log₂((A XOR B)+1)⌉

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?

p=32−⌈log₂((A XOR B)+1)⌉

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.

Also try:

Back to category →