CIDR Notation Explained -- How to Read, Calculate, and Plan IP Subnets

Learn how CIDR notation works, how to read the /prefix format, calculate network sizes, and plan IP address blocks with worked examples.

The Quick Answer

CIDR notation is a compact way to specify an IP address and its associated network mask using a slash followed by the prefix length, such as 192.168.1.0/24.

The number after the slash tells you how many of the 32 bits (in IPv4) belong to the network portion. The remaining bits identify individual hosts on that network.

Usable hosts = 2^(32 - prefix) - 2

A /24 gives 2^8 - 2 = 254 usable hosts. A /28 gives 2^4 - 2 = 14 usable hosts.

Use our CIDR calculator to instantly compute the network range, broadcast address, and usable hosts for any CIDR block.

What Is CIDR?

CIDR stands for Classless Inter-Domain Routing. It is an addressing scheme that replaced the old classful system (Class A, B, C) in 1993, as defined in RFC 1519 and later updated by RFC 4632.

CIDR notation is a method of writing an IP address together with its routing prefix that tells you exactly how large the network is. The old classful system forced networks into fixed sizes -- a Class C was always /24 (254 hosts), a Class B was always /16 (65,534 hosts), and a Class A was always /8 (16.7 million hosts). If you needed 500 hosts, you had to take a Class B with 65,534 addresses and waste over 65,000 of them.

CIDR allows any prefix length from /0 to /32, so you can size a network to match what you actually need. Need 500 hosts? A /23 gives you 510 usable addresses.

How to Read CIDR Notation

The format is straightforward:

[IP address] / [prefix length]

For example:

10.0.0.0/22
  • 10.0.0.0 is the network address (the starting IP of the block)
  • /22 means the first 22 bits are the network portion, leaving 10 bits for hosts

The prefix length directly maps to a subnet mask. You can convert between them:

Prefix Subnet Mask Host Bits Total Addresses Usable Hosts
/8 255.0.0.0 24 16,777,216 16,777,214
/16 255.255.0.0 16 65,536 65,534
/24 255.255.255.0 8 256 254
/25 255.255.255.128 7 128 126
/26 255.255.255.192 6 64 62
/27 255.255.255.224 5 32 30
/28 255.255.255.240 4 16 14
/29 255.255.255.248 3 8 6
/30 255.255.255.252 2 4 2
/31 255.255.255.254 1 2 2 (point-to-point)
/32 255.255.255.255 0 1 1 (single host)

Note that /31 and /32 are special cases. A /31 is used for point-to-point links between two routers (RFC 3021) and has no network or broadcast address. A /32 identifies a single host and is used in routing tables and firewall rules.

The Usable Hosts Formula

For standard CIDR blocks (/30 and larger):

Usable hosts = 2^(32 - prefix) - 2

You subtract 2 because the first address in the block is the network address (identifies the subnet itself) and the last address is the broadcast address (sends a packet to every host on the subnet). Neither can be assigned to a device.

Quick reference for mental math:

  • /24: 2^8 - 2 = 254
  • /25: 2^7 - 2 = 126
  • /26: 2^6 - 2 = 62
  • /27: 2^5 - 2 = 30
  • /28: 2^4 - 2 = 14
  • /29: 2^3 - 2 = 6
  • /30: 2^2 - 2 = 2

Each time you increase the prefix by 1, you halve the number of addresses.

Worked Example 1: Breaking Down 10.0.0.0/22

Given the CIDR block 10.0.0.0/22, find the network address, broadcast address, usable range, and host count.

Step 1 -- Identify the prefix split.

The prefix is /22, so 22 bits are network and 10 bits are host.

Step 2 -- Write the binary breakdown.

IP:   10.0.0.0      ->  00001010.00000000.00000000.00000000
Mask: 255.255.252.0  ->  11111111.11111111.11111100.00000000
                         |---- 22 network bits ----|-- 10 --|

Step 3 -- Find the network address.

Bitwise AND the IP with the mask. Since the IP is 10.0.0.0 and all host bits are already zero, the network address is 10.0.0.0.

Step 4 -- Find the broadcast address.

Set all 10 host bits to 1:

Network:   00001010.00000000.00000000.00000000
Broadcast: 00001010.00000000.00000011.11111111 -> 10.0.3.255

Step 5 -- Determine the usable range.

  • First usable: 10.0.0.1
  • Last usable: 10.0.3.254

Step 6 -- Count usable hosts.

2^10 - 2 = 1024 - 2 = 1,022 usable hosts

The block spans from 10.0.0.0 through 10.0.3.255 -- that is four consecutive /24-sized chunks (10.0.0.x, 10.0.1.x, 10.0.2.x, 10.0.3.x).

Worked Example 2: Splitting a /24 into Four /26 Subnets

Suppose you have the block 192.168.10.0/24 and need to divide it into four equal subnets.

Increasing the prefix by 2 (from /24 to /26) creates 2^2 = 4 subnets, each with 2^6 = 64 total addresses (62 usable).

Subnet Network Address Usable Range Broadcast Usable Hosts
1 192.168.10.0/26 192.168.10.1 -- 192.168.10.62 192.168.10.63 62
2 192.168.10.64/26 192.168.10.65 -- 192.168.10.126 192.168.10.127 62
3 192.168.10.128/26 192.168.10.129 -- 192.168.10.190 192.168.10.191 62
4 192.168.10.192/26 192.168.10.193 -- 192.168.10.254 192.168.10.255 62

Each subnet boundary falls at a multiple of 64 (the block size): .0, .64, .128, .192. The total of 4 x 64 = 256 addresses accounts for the entire original /24.

Supernetting: Combining Blocks

Supernetting (also called route aggregation or CIDR aggregation) is the reverse of subnetting. Instead of dividing a block into smaller pieces, you combine multiple contiguous blocks into one larger block.

Example: You have four consecutive /24 networks:

  • 10.1.0.0/24
  • 10.1.1.0/24
  • 10.1.2.0/24
  • 10.1.3.0/24

These can be summarized as a single 10.1.0.0/22. Verify in binary:

10.1.0.0   -> 00001010.00000001.000000|00.00000000
10.1.1.0   -> 00001010.00000001.000000|01.00000000
10.1.2.0   -> 00001010.00000001.000000|10.00000000
10.1.3.0   -> 00001010.00000001.000000|11.00000000
                                      ^
                 First 22 bits are identical -- prefix is /22

Supernetting reduces routing table size. Instead of advertising four separate routes, a router advertises one. This is critical for keeping the global internet routing table manageable -- the IANA IPv4 address space is organized around aggregated CIDR blocks for exactly this reason.

Rule: You can only aggregate blocks that are contiguous and whose count is a power of 2 (2, 4, 8, 16, ...), and the first block's address must be evenly divisible by the total size.

Private IP Address Ranges in CIDR

RFC 1918 reserves three CIDR blocks for private use. These addresses are not routed on the public internet:

CIDR Block Address Range Total Addresses Common Use
10.0.0.0/8 10.0.0.0 -- 10.255.255.255 16,777,216 Cloud VPCs (AWS, Azure, GCP), large enterprises
172.16.0.0/12 172.16.0.0 -- 172.31.255.255 1,048,576 Docker default networks, medium organizations
192.168.0.0/16 192.168.0.0 -- 192.168.255.255 65,536 Home routers, small office networks

Note that 172.16.0.0/12 is frequently misunderstood. The /12 prefix means the range extends from 172.16.x.x through 172.31.x.x -- not just 172.16.x.x. The second octet covers 16 through 31 (16 values, because 2^4 = 16).

CIDR Notation vs. Subnet Mask: When to Use Which

CIDR notation and subnet masks encode the same information. A /24 is exactly equivalent to 255.255.255.0. The choice depends on context:

Use CIDR notation when:

  • Configuring cloud infrastructure (AWS VPCs, security groups, Azure NSGs)
  • Writing firewall rules
  • Documenting network architecture
  • Configuring BGP routing

Use subnet mask notation when:

  • Configuring operating system network interfaces
  • Setting up DHCP servers
  • Working with older networking equipment
  • Some legacy application configuration files

Most modern tools accept both formats.

Calculate Any CIDR Block

CIDR Calculator

Enter any IP address with a CIDR prefix to instantly see the network range, broadcast address, usable hosts, and binary breakdown.

Open CIDR Calculator

Frequently Asked Questions

What does /24 mean in CIDR notation?

The /24 means the first 24 of the 32 bits in an IPv4 address identify the network. The remaining 8 bits are for hosts, giving 256 total addresses (254 usable). The equivalent subnet mask is 255.255.255.0.

How many IP addresses are in a /28 block?

A /28 block contains 16 total IP addresses (2^4 = 16). Of those, 14 are usable for hosts after subtracting the network address and broadcast address.

What is the difference between CIDR notation and a subnet mask?

They express the same information in different formats. CIDR notation uses a slash followed by the number of network bits (e.g., /24), while a subnet mask writes the same thing in dotted decimal (e.g., 255.255.255.0). CIDR notation is shorter and more common in modern usage.

Why do you subtract 2 from the usable host count?

The first address in a CIDR block is the network address (identifies the subnet) and the last address is the broadcast address (sends traffic to all hosts). Neither can be assigned to a device, so you subtract 2. The exceptions are /31 (point-to-point links, per RFC 3021) and /32 (single host).

What is supernetting in CIDR?

Supernetting (also called route aggregation) combines multiple smaller CIDR blocks into one larger block. For example, four contiguous /24 networks can be summarized as a single /22. This reduces the number of entries in routing tables and is fundamental to how internet routing scales.

What are the private IP address ranges in CIDR notation?

RFC 1918 defines three private ranges: 10.0.0.0/8 (16.7 million addresses), 172.16.0.0/12 (about 1 million addresses), and 192.168.0.0/16 (65,536 addresses). These are not routable on the public internet and are used for internal networks behind NAT.

How do I split a /24 into smaller subnets?

Increase the prefix length by 1 to split into 2 subnets, by 2 to split into 4, and so on. A /24 split into four /26 subnets gives four blocks of 64 addresses each (62 usable hosts per block). The subnet boundaries fall at multiples of the block size.

What does /32 mean?

A /32 means all 32 bits are the network portion, leaving zero bits for hosts. It identifies exactly one IP address. /32 is used in routing tables to create a host route and in firewall rules to match a single specific address.

What is the largest CIDR block?

For IPv4, /0 is the largest possible block and covers all 4,294,967,296 addresses (the entire IPv4 address space). In practice, the largest blocks allocated by IANA to regional registries are /8 blocks containing 16,777,216 addresses each.

How is CIDR different from the old classful addressing system?

Classful addressing fixed networks at /8 (Class A), /16 (Class B), or /24 (Class C) boundaries, wasting large amounts of address space. CIDR allows any prefix length from /0 to /32, so networks can be sized precisely to the number of hosts needed. CIDR was introduced in 1993 and is defined in RFC 4632.

Related Topics

Related Tools