FernTool

What is CIDR notation?

CIDR notation is the short way of writing a block of IP addresses: an address, a slash, and a number, like 192.168.1.0/24. The number after the slash says how many bits at the start of the address are fixed for the network. Everything after that is free for devices. Bigger number = smaller block. To see any block worked out instantly, type it into the subnet calculator.


The slash number in one sentence

An IPv4 address has 32 bits. /24 means “the first 24 bits are the network”, which leaves 32 − 24 = 8 bits for devices, so the block holds 28 = 256 addresses. Every time the number goes up by one, the block halves; every time it goes down by one, it doubles.

Quick table: CIDR to subnet mask and size

CIDRSubnet maskAddressesUsable devices
/8255.0.0.016,777,21616,777,214
/16255.255.0.065,53665,534
/20255.255.240.04,0964,094
/21255.255.248.02,0482,046
/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 (a single address)

“Usable devices” is two less than the size, because in IPv4 the first address names the network and the last is the broadcast address. Every row from /8 to /32 is in the subnet mask cheat sheet.

First and last IP address in a CIDR range

A block always starts at the network address and runs for its size. Some worked examples (click one to see it in the calculator):

Quick rule: if the slash number is between 17 and 24, the third number grows by 2(24 − slash), so a /22 covers 4 values of the third number and a /20 covers 16. To cut a block into smaller pieces (for example a /24 into four /26s), use “Split into” on the subnet calculator.

How to turn a subnet mask into CIDR (and back)

Write each part of the mask as 8 bits and count the 1s. 255 is 11111111 (8 ones), 255 is 8, 255 is 8, 0 is 0: 8 + 8 + 8 + 0 = /24. For 255.255.255.192: 192 is 11000000, two ones, so 24 + 2 = /26. The only values you’ll ever see in a mask are 0, 128, 192, 224, 240, 248, 252, 254 and 255 (0 to 8 ones). Going the other way, /20 = 8 + 8 + 4, so the mask is 255.255.240.0.

Where you’ll see CIDR notation

CIDR for IPv6

IPv6 works exactly the same way, just with 128 bits and no dotted mask. /64 is one network (the size every LAN should be), a /56 holds 256 of those and a /48 holds 65,536. ISPs usually give a home or business a /56 or /48. The IPv6 subnet calculator lists every /64 inside your block.

Common mistakes

Frequently asked questions

What does /24 mean in an IP address?

It means the first 24 of the 32 bits are the network part. That leaves 8 bits, so the block has 256 addresses (254 usable devices), and the subnet mask is 255.255.255.0.

Why is it called CIDR?

CIDR stands for Classless Inter-Domain Routing, introduced in 1993. Before it, networks came in fixed “class” sizes (A, B and C). CIDR lets a block be any size, written with the slash number.

Is CIDR the same as a subnet mask?

They describe the same thing in two ways. /24 and 255.255.255.0 are identical; CIDR is just shorter and also works for IPv6, which doesn’t use dotted masks.

How many IP addresses are in a /22?

A /22 has 1,024 addresses (2 to the power 10), of which 1,022 are usable for devices in IPv4. Its mask is 255.255.252.0, and it covers four /24 networks, for example 192.168.0.0 to 192.168.3.255.

What does 0.0.0.0/0 mean?

It means every IPv4 address. You see it as the default route on routers (send anything not local this way) and in firewall rules, where 0.0.0.0/0 means anyone on the internet. The IPv6 version is ::/0.

What is a /32 in CIDR?

A /32 is a single IPv4 address: all 32 bits are fixed, so the block holds exactly one address. Firewall and allow-list rules use it to mean just this one IP, for example 203.0.113.5/32. In IPv6 the same idea is /128.

How many IP addresses are in a /16?

A /16 has 65,536 addresses (2 to the power 16), of which 65,534 are usable for devices in IPv4. Its mask is 255.255.0.0.

More guides