What is CIDR ?

 CIDR (Classless Inter-Domain Routing) is a method of representing IP networks that tells you how much of an IP address identifies the network and how much identifies the host (device).


CIDR (Classless Inter-Domain Routing) is a method of representing IP networks that tells you how much of an IP address identifies the network and how much identifies the host (device).

The format is:

IP_Address/Prefix_Length

For example:

192.168.1.0/24
  • 192.168.1.0 = Network address

  • /24 = The first 24 bits are the network portion.

How CIDR works

An IPv4 address has 32 bits, divided into four octets (8 bits each).

Example:

192.168.1.10

Binary:
11000000.10101000.00000001.00001010

If the CIDR is /24, it means:

Network bits                  Host bits
11111111.11111111.11111111.00000000
^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^^
        24 bits                  8 bits

The first 24 bits identify the network, and the remaining 8 bits identify individual devices.

CIDR and subnet mask

Each CIDR prefix corresponds to a subnet mask.

CIDRSubnet MaskTotal IPsUsable Hosts
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/29255.255.255.24886
/30255.255.255.25242
/32255.255.255.25511 (single IP)

Example 1: /24

Network: 192.168.1.0/24

Network Address : 192.168.1.0
First Host      : 192.168.1.1
Last Host       : 192.168.1.254
Broadcast        : 192.168.1.255

Example 2: /26

A /24 network can be divided into four /26 subnets:

192.168.1.0/26      → Hosts: .1 - .62
192.168.1.64/26     → Hosts: .65 - .126
192.168.1.128/26    → Hosts: .129 - .190
192.168.1.192/26    → Hosts: .193 - .254

Each /26 subnet contains:

  • 64 total IP addresses

  • 62 usable host addresses

Why use CIDR?

CIDR replaced the older "classful" addressing system because it allows more efficient use of IP addresses.

For example:

  • A small office might need only 30 addresses, so it can use a /27 network instead of a full /24.

  • A cloud provider can assign exactly the number of addresses a customer needs, reducing waste.

Easy way to remember

Think of the number after the slash as "how many bits belong to the network."

  • Larger prefix (e.g. /30) → smaller network, fewer host addresses.

  • Smaller prefix (e.g. /16) → larger network, more host addresses.

A quick memory trick:

  • /24256 total IPs

  • /25128 total IPs

  • /2664 total IPs

  • /2732 total IPs

  • /2816 total IPs

Each time the prefix increases by 1, the size of the network is cut roughly in half.

Comments