Fundamentals5 min read

CIDR Notation Explained

CIDR (Classless Inter-Domain Routing) is the standard way to express IP addresses and their network prefixes. This guide explains what CIDR notation means and how to use it.

What is CIDR?

CIDR stands for Classless Inter-Domain Routing. It was introduced in 1993 (RFC 1519) to replace the older classful addressing system (Class A, B, C) and make IP address allocation far more efficient.

In CIDR notation, an IP address is followed by a slash and a number representing the prefix length — for example, 192.168.1.0/24. This single string contains all the information needed to define a subnet.

The Prefix Length

The number after the slash in CIDR notation is the prefix length — it tells you how many bits of the 32-bit IP address are the network portion. The remaining bits are the host portion.

  192.168.1.0 / 24
  ─────────────────
  IP address  │ Prefix length
              │
              └─ 24 bits = network
                  8 bits = host

A higher prefix length means a smaller network (fewer host addresses). A lower prefix means a larger network.

PrefixNetwork bitsHost bitsTotal addresses
/882416,777,216
/16161665,536
/24248256
/2828416
/303024
/323201

Converting Between CIDR and Subnet Mask

Every CIDR prefix length maps exactly to one subnet mask. To convert, write N ones followed by (32-N) zeros in binary, then convert each 8-bit group to decimal:

/24 → 11111111.11111111.11111111.00000000 → 255.255.255.0
/20 → 11111111.11111111.11110000.00000000 → 255.255.240.0
/28 → 11111111.11111111.11111111.11110000 → 255.255.255.240

To convert a subnet mask back to CIDR, count the number of 1-bits. Our subnet mask to CIDR calculator handles this automatically — enter the mask in the Subnet Mask field and the CIDR dropdown updates instantly.

Calculating Host Counts from a Prefix

The number of total addresses in a CIDR block is always a power of 2: 2^(32 - prefix). Usable host addresses subtract 2 (network address and broadcast address):

Total addresses = 2^(32 - prefix)
Usable hosts    = 2^(32 - prefix) - 2  (for prefix ≤ 30)

Examples:
  /24 → 2^8  = 256 total, 254 usable
  /27 → 2^5  =  32 total,  30 usable
  /30 → 2^2  =   4 total,   2 usable

Supernetting and Route Summarisation

CIDR also enables supernetting — aggregating multiple smaller networks into one larger prefix to reduce routing table size. For example, four consecutive /26 networks can be summarised as one /24:

192.168.1.0/26   ┐
192.168.1.64/26  ├─ summarised as 192.168.1.0/24
192.168.1.128/26 │
192.168.1.192/26 ┘

This is the mechanism ISPs use to advertise only a small number of routes for millions of customers — a critical part of making the global internet routing table manageable.

Quick Reference: CIDR Blocks

CIDRMaskAddressesUsableBlock size
/8255.0.0.016,777,21616,777,21416,777,216
/16255.255.0.065,53665,53465,536
/24255.255.255.0256254256
/25255.255.255.128128126128
/26255.255.255.192646264
/27255.255.255.224323032
/28255.255.255.240161416
/29255.255.255.248868
/30255.255.255.252424
/32255.255.255.255111

View all 33 entries in our full CIDR chart /1–/32.