Simplify management and monitoring with NetworkCalc Pro

Understanding CIDR notation in IP subnets

Matthew Fisher - December 6, 2021

Cover image for article: Understanding CIDR notation in IP subnets.
local_offer Subnets
A short guide with everything you need to know to understand CIDR subnet notation.

IP addresses are used throughout the Internet and in private networks to represent individual devices, such as laptops, smartphones, printers, servers, and routers. In order to participate in a network, a device must have a unique IP address. Computer networks can be viewed as collections of hosts, each with a unique IP address, that can communicate with each other.

Networks of IP addresses can be represented in different forms. In this article, I will clarify the CIDR notation for IP addresses and show how you can convert between IP ranges and CIDR block notation.

What is CIDR Notation?

CIDR notation was developed in the early 1990s as a more flexible way of defining subnets. The previous system for IPv4 networks consisted of classes - class A, B, and C - each a different size and able to support a different number of hosts. The class system for networks is summarized in the table below.

IP Address Class # Subnet Bits Subnet Mask # Addresses Example IP Address Range
Class A 8 16,777,216 -
Class B 16 65,534 -
Class C 24 254 -

CIDR notation consists of an IP address followed by a forward slash followed by the number of subnet bits. CIDR notation gives a compact format for specifying the size of a subnet. Using CIDR notation, we can define blocks of IP addresses of any size, whereas the class system only allows for three sizes.

How to Convert an IP Range to CIDR Notation

I'll take you through the process of converting IP ranges to CID notations and CIDR notation to IP address ranges. The process is pretty straightforward.

To convert an IP range to CIDR notation, select an IP address from the subnet (ideally the network address) and add a forward slash (/) followed by the number of bits representing the subnet mask (example: If you're not familiar with subnets and masks, I have a good article on subnetting that will walk you through the details.

Let's look at an example. Suppose you have the IP address range through The subnet mask for this subnet is If we convert the subnet mask to its binary representation, we would get a sequence of 24 ones and 8 zeroes: 11111111111111111111111100000000. The number of ones is the same as the number of subnet bits, 24. The CIDR notation for the IP range - is

Let me summarize what we just did to make it clear. To convert an IP address range to CIDR notation, convert the subnet mask to binary, count the number of ones, and add this number to the IP address following a forward slash. This process can be reversed to obtain the IP range again.

That's all there is to it! The CIDR notation is a more compact format than an IP address range and I find it much easier to read. It is trivial to convert between CIDR notation and IP ranges, especially with the help of an online subnet calculator like the one below.

Online Subnet Calculator

Use CIDR notation to quickly look up details of IPv4 subnets and CIDR blocks.

Resources for More Information

Below are a few resources for more information about Classless Inter-Domain Routing.

Resource Publisher
What Is CIDR Notation? WhatIsMyIPAddress
What is subnetting? NetworkCalc
CIDR Notation - Explained & Examples ShellHacks

All of the NetworkCalc tools and public APIs are free to use. Integrate your IP subnets using our NetworkCalc Pro APIs.

Subscribe for more articles like this.