CIDR Notation Explained Simply (With Examples and a Cheat Sheet)

You have probably seen IP addresses written like 192.168.1.0/24 or 10.0.0.0/8. That slash and number is CIDR notation, and it is the standard way to describe networks today, from home routers to cloud platforms.

In this guide, CIDR notation is explained simply: what the number means, how to turn it into a subnet mask, how many addresses each prefix contains and why it replaced the old network classes.

CIDR notation explained: 192.168.1.0/24 and its subnet mask

CIDR Notation Explained: What the Slash Means

CIDR stands for Classless Inter-Domain Routing. In short, CIDR notation explained in one line is this: an IP address followed by a slash and a number. Simply put, the number after the slash is the prefix length: how many of the 32 bits in an IPv4 address belong to the network. The bits that are left identify individual devices.

For example, in 192.168.1.0/24, the first 24 bits (192.168.1) are the network and the last 8 bits are for hosts. As a result, this network has 2⁸ = 256 addresses.

From CIDR to Subnet Mask

In fact, a subnet mask and a CIDR prefix describe exactly the same thing, which is why CIDR notation is so easy to convert. Put differently, the mask simply writes the network bits as ones in dotted decimal:

/24 = 11111111.11111111.11111111.00000000 = 255.255.255.0
/26 = 11111111.11111111.11111111.11000000 = 255.255.255.192
/16 = 11111111.11111111.00000000.00000000 = 255.255.0.0

In other words, each full octet of ones is 255, and the partial octet is the sum of its bits: 128, 192, 224, 240, 248, 252, 254 or 255.

How Many Addresses Does a CIDR Notation Prefix Have?

Because every bit doubles the size, CIDR notation makes the count easy. Use this simple formula: addresses = 2 to the power of (32 − prefix). Then subtract two to get the usable hosts, because the first address is the network and the last one is the broadcast.

  • /24: 2⁸ = 256 addresses, 254 usable hosts.
  • /26: 2⁶ = 64 addresses, 62 usable hosts.
  • /20: 2¹² = 4,096 addresses, 4,094 usable hosts.

Notice the pattern: as a result, every time the prefix goes up by one, the network becomes half as big.

CIDR Notation Cheat Sheet

CIDRSubnet maskAddressesUsable hosts
/8255.0.0.016,777,21616,777,214
/12255.240.0.01,048,5761,048,574
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/22255.255.252.01,0241,022
/23255.255.254.0512510
/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 host)
CIDR notation explained: common prefixes, masks and host counts

This table sums everything up at a glance, so bookmark it for later. However, you do not need to memorize all of it. Instead, enter any address with its prefix in our free subnet calculator and it shows the mask, the range and the number of hosts instantly.

Why CIDR Replaced Network Classes

Before CIDR notation existed, networks came in fixed sizes called classes. For example, a Class C network had 256 addresses, while a Class B had 65,536, with nothing in between. Consequently, an organization that needed 1,000 addresses had to take a whole Class B and waste most of it.

However, CIDR, introduced in the 1990s and described today in RFC 4632, removed those fixed sizes. Now a network can be any size, from a single address to millions, which saves addresses and keeps internet routing tables much smaller.

Combining Networks (Route Aggregation)

CIDR notation also works in the other direction. For example, two neighboring networks can be described as one larger block, which routers use to simplify their tables. For example:

192.168.0.0/24  +  192.168.1.0/24  =  192.168.0.0/23

With CIDR notation explained this way, route aggregation is easy to follow. As you can see, the /23 covers both /24 networks because it has one network bit fewer, so it is twice as big. This only works when the blocks are next to each other and the first one starts on a boundary of the larger size.

CIDR Notation Explained in Everyday Use

  • Home routers usually create a 192.168.x.0/24 network for your devices.
  • Cloud platforms ask you to choose a CIDR block when you create a virtual network.
  • Firewalls use CIDR to allow or block whole ranges, such as 10.0.0.0/8.
  • IPv6 uses the same notation, and a typical home network there is a /64.

Now that you have CIDR notation explained, the next step is practice. To do that, read our step-by-step guide on how to calculate subnets by hand, which uses CIDR prefixes in every example.

FAQ: CIDR Notation

What does /24 mean in an IP address?

It means the first 24 bits of the address are the network part. This equals the subnet mask 255.255.255.0 and gives 256 addresses, of which 254 can be used by devices.

Is CIDR the same as a subnet mask?

Yes. They describe the same information in two formats. CIDR writes the number of network bits after a slash, while a subnet mask writes those bits in dotted decimal.

How do I convert CIDR to a subnet mask?

Write the prefix as that many ones followed by zeros, split into four groups of 8 bits, and convert each group to decimal. For example, /26 becomes 255.255.255.192.

Leave a Comment