CIDR Notation
What is CIDR notation?
CIDR (Classless Inter-Domain Routing) notation writes an IP network as an address followed by a slash and a prefix length, for example 192.168.1.0/24. The prefix length is the number of leading bits that identify the network; the remaining bits identify hosts.
How to read a CIDR block
In 192.168.1.0/24, the first 24 bits (192.168.1) are the network and the last 8 bits are hosts. The block holds 2^(32−24) = 256 addresses, from 192.168.1.0 to 192.168.1.255. Each step down in the prefix doubles the size: a /23 holds 512 addresses, a /22 holds 1,024.
Try it
e.g. 10.0.0.0/22, 10.0.0.0 - 10.0.5.255
CIDR block → IP range
| First IP | 192.168.1.0 | |
|---|---|---|
| Last IP | 192.168.1.255 | |
| Total addresses | 256 | |
| Subnet mask | 255.255.255.0 | |
| Wildcard mask | 0.0.0.255 | |
| Prefix length | /24 | |
| CIDR block | 192.168.1.0/24 |
Runs entirely in your browser. Nothing you enter is sent to a server.
CIDR to subnet mask
Write the prefix as that many 1 bits followed by 0 bits and convert each octet to decimal. /24 = 255.255.255.0, /20 = 255.255.240.0, /16 = 255.255.0.0, /8 = 255.0.0.0. See the full subnet cheat sheet.
Why CIDR replaced IP classes
Before 1993, networks came in fixed Class A (/8), B (/16) and C (/24) sizes. An organization needing 2,000 addresses had to take a whole Class B of 65,536 and waste most of it. CIDR (RFC 1519, now RFC 4632) allows any prefix length, so that organization can use a /21 (2,048 addresses), and routers can summarize many networks into one route.
CIDR notation in IPv6
IPv6 uses the same format with 128-bit addresses: 2001:db8::/32 fixes the first 32 bits. Typical sizes are /48 for a site, /56 for a home connection and /64 for a single LAN. Use theIPv6 subnet calculator.
Frequently asked questions
What does /24 mean in an IP address?
The first 24 bits are the network. It equals subnet mask 255.255.255.0 and gives 256 addresses (254 usable hosts).
What does /32 mean?
A single IP address. It is used for host routes, loopbacks and firewall rules that match exactly one address.
What does 0.0.0.0/0 mean?
Every IPv4 address. It is the default route.
Is CIDR the same as subnetting?
CIDR is the notation and the classless addressing scheme; subnetting is dividing a network into smaller ones. You use CIDR notation to describe the subnets you create.