Skip to content

Glossary

CIDR notation: IP ranges written as a prefix

CIDR notation (RFC 4632) writes an IP range as an address and a prefix length, such as 192.0.2.0/24. How to read it, count addresses and use it in rules.

Updated 2026-11-23

CIDR notation writes a block of consecutive IP addresses as a base address, a slash and a prefix length: 192.0.2.0/24. The prefix length says how many leading bits are fixed. The rest identify hosts inside the block. CIDR is specified in RFC 4632 for IPv4, and IPv6 uses the same notation.

How it works

An IPv4 address has 32 bits. A /24 fixes the first 24, leaving 8 free:

CIDR Free bits Addresses Example range
/32 0 1 203.0.113.7
/30 2 4 203.0.113.4 to 203.0.113.7
/24 8 256 203.0.113.0 to 203.0.113.255
/16 16 65,536 203.0.0.0 to 203.0.255.255
/8 24 16,777,216 203.0.0.0 to 203.255.255.255

Each step towards a shorter prefix doubles the size. For IPv6 the address has 128 bits. A /64 is the standard size of a single network, and providers hand households blocks such as /56 or /48.

2001:db8::/32   documentation range (RFC 3849)
192.0.2.0/24    documentation range (RFC 5737)
10.0.0.0/8      private range (RFC 1918)

Where you meet CIDR:

  • Routing. An ASN announces a list of prefixes, and routers pick the most specific match.
  • Firewalls and allowlists. Rules apply to a block, not a host.
  • SPF records. ip4:203.0.113.0/24 authorizes a range of senders.
  • DNSBL and abuse lists. Listings often cover a whole block.
  • IP geolocation. Databases map prefixes to places.

Mistakes to avoid: writing a base address that does not align with the prefix (192.0.2.5/24 is read as 192.0.2.0/24), and confusing the number of free bits with the number of fixed ones.

Why it matters for validation

Network signals describe blocks, and every IP lookup answers for the block that contains the address. The IP API tells you the ASN, network type and flags of the network that announces the address, so one lookup characterizes everyone nearby. That is also why a flag on a hosting block applies to all addresses in it.

For your own rules:

  • Block ranges with care: the block may hold thousands of unrelated users, particularly on mobile networks that share addresses.
  • Use the prefix length to size a rule before you apply it.
  • Send addresses to the API one by one: it takes an address, not a prefix.

Special-purpose ranges, such as private and loopback addresses, cannot be looked up at all. The API answers 422 unprocessable_input for them, as the IP reference lists.

Frequently asked questions

What is CIDR notation?
CIDR, Classless Inter-Domain Routing, is the way to write a block of IP addresses as an address followed by a slash and the number of fixed leading bits, such as 203.0.113.0/24. It is defined in RFC 4632 for IPv4 and used the same way for IPv6. The bits after the prefix are free to vary.
How many addresses are in a /24?
256 addresses in IPv4, since 32 minus 24 leaves 8 free bits and 2 to the power 8 is 256. A /16 holds 65,536, a /32 is a single address. For each step down in prefix length the block doubles. In IPv6, a /64 is the usual size of a subnet.
Why does CIDR matter for blocking or allowlisting IPs?
Because networks own ranges, not single addresses. Blocking one address misses the rest of an abuser's block, and allowlisting a /8 by mistake lets in millions. Reading the prefix length tells you how many addresses a rule affects. Firewalls, SPF records and blocklists all use CIDR.

Put this check in your product

Get an API key in under a minute. 100 free credits every month, no card required.

  • 100 free credits a month
  • No card
  • Test keys spend nothing
  • Cancel any time