Home / Network guides / Guide: what is CIDR

What Is CIDR?

CIDR is the way we write IP address blocks, such as 192.168.1.0/24. Here is how it works and how to do the maths by hand.

The short answer

CIDR stands for Classless Inter-Domain Routing. It is a method for describing a block of IP addresses with an address and a prefix length, written as 203.0.113.0/24. The prefix length says how many leading bits are the same for every address in the block.

Why CIDR exists

Early internet addressing used fixed classes: class A networks had 16 million addresses, class B had 65,536 and class C had 256. Most organisations fell between the sizes, so addresses were wasted and routing tables grew fast. CIDR, introduced in the early 1990s and now described in RFC 4632, lets a block be any power of two in size and lets routers combine many blocks into one entry.

Reading the notation

In 10.4.0.0/14 the address is 10.4.0.0 and the prefix length is 14. An IPv4 address has 32 bits, so 14 bits identify the network and 18 bits are left for hosts. The block holds 2 to the power of 18, which is 262,144 addresses.

Counting by hand

Take the address 192.168.1.130/26.

  1. The prefix is 26, so there are 6 host bits and each block holds 2 to the power of 6, which is 64 addresses.
  2. The mask is 255.255.255.192, since 192 is 128 + 64.
  3. Blocks in the last number start at 0, 64, 128 and 192. The address ends in 130, so it is in the block that starts at 128.
  4. The network address is 192.168.1.128 and the broadcast address is 192.168.1.191.
  5. The usable hosts are 192.168.1.129 to 192.168.1.190, which is 62 hosts.

You can check any block with the CIDR calculator.

Private and special ranges

BlockUse
10.0.0.0/8Private network (RFC 1918)
172.16.0.0/12Private network (RFC 1918), 172.16.0.0 to 172.31.255.255
192.168.0.0/16Private network (RFC 1918)
100.64.0.0/10Shared address space for carrier grade NAT
127.0.0.0/8Loopback
169.254.0.0/16Link-local, used when no address is assigned
0.0.0.0/0Every IPv4 address, used as the default route

Variable length subnet masks

With CIDR you can cut a network into subnets of different sizes, called VLSM. A /24 can become one /25 for a large office, one /26 for a smaller one and two /27 blocks for equipment. Allocate the largest subnets first, because each block must start on a boundary that matches its size.

Summarization

The reverse is also useful. The four networks 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24 and 192.168.3.0/24 are contiguous and aligned, so one route, 192.168.0.0/22, covers them all. Smaller routing tables are the main reason CIDR was adopted. The IP range to CIDR tool finds the shortest summary for any range.

CIDR in IPv6

IPv6 uses the same notation with 128 bits. The usual sizes are a /64 for one network, a /48 for a site and a /32 for a large provider allocation. There is no broadcast address, and every address in a /64 can be used. An example is 2001:db8::/32, a range reserved for documentation.

Common mistakes

  • Counting all addresses as hosts. In most IPv4 subnets two are reserved, and some cloud platforms reserve more.
  • Setting host bits in the network address. 192.168.1.77/24 describes the block 192.168.1.0/24. Many routers and cloud services reject such entries.
  • Overlapping blocks. Two subnets or two VPN networks that overlap cause routing problems. Check before you connect networks.
  • Picking a subnet that is too tight. Leave room for growth.

CIDR in the cloud

Cloud networks are defined with CIDR blocks. An Amazon VPC accepts blocks from /16 to /28, and each subnet inside it is a smaller block. Plan non-overlapping ranges for every network you might later connect with peering or a VPN.

Handy tools: CIDR to subnet mask and subnet mask to CIDR.

Work it out instantly. Enter any CIDR block and see the mask, range and host count.

Open the CIDR calculator

Frequently asked questions

What does CIDR stand for?

Classless Inter-Domain Routing. It describes IP address blocks with a prefix length instead of fixed classes.

What is the difference between CIDR and a subnet mask?

They carry the same information. /24 and 255.255.255.0 mean the same thing. CIDR is the shorter way to write it.

How many addresses are in a /30?

Four addresses, of which two are usable hosts. It is often used for links between two routers.

What is 0.0.0.0/0?

The whole IPv4 address space. In a routing table it is the default route.