Skip to content
Addressing and routing

· 5 min read

CIDR notation and subnetting explained

A slash and a number after an address, like /24, is all of subnetting in one symbol. It says how many of the address's bits name the network. This guide reads it, works two examples by hand, and shows where a calculator saves time.

On this page

What the slash means#

CIDR notation writes an address, a slash and a number: 192.168.10.0/26. The number is the prefix length: how many of the address's bits, counting from the left, identify the network. The rest identify a host inside it. An IPv4 address has 32 bits, so a /26 leaves 32 − 26 = 6 bits for hosts, and 2^6 = 64 addresses in the block.

A /26 splits the 32 address bits into network and hostFor 192.168.10.0/26, the first 26 of the 32 bits identify the network and the last 6 bits identify the host, which gives 2 to the power 6, or 64 addresses, of which 62 can be assigned to hosts.19216810026 network bits6 host bitsHost bits give 2⁶ = 64 addressesFirst is the network address, last is the broadcast:62 usable hosts: .1 to .62
For 192.168.10.0/26 the first 26 bits are the network and the last 6 are the host, which gives 64 addresses.

A prefix length is just another way to write a subnet mask. A /26 means 26 one-bits followed by 6 zero-bits, which in dotted decimal is 255.255.255.192. The two notations carry the same information. CIDR is shorter, and it is what routers, cloud consoles and firewall rules use. The idea replaced the old address classes in 1993 (RFC 4632).

Common prefix lengths#

IPv4 prefixes, masks and sizes
PrefixSubnet maskAddressesUsable hostsTypical use
/8255.0.0.016,777,21616,777,214The largest private block, 10.0.0.0/8
/16255.255.0.065,53665,534A large site or the home range 192.168.0.0/16
/20255.255.240.04,0964,094A campus or a cloud virtual network
/22255.255.252.01,0241,022A medium site
/24255.255.255.0256254An ordinary local network
/25255.255.255.128128126Half a /24
/26255.255.255.1926462A department, a floor, a guest network
/27255.255.255.2243230A small office
/28255.255.255.2401614A server segment
/29255.255.255.24886A handful of servers or a small business line
/30255.255.255.25242A point-to-point link, the classic size
/31255.255.255.25422 (point-to-point only)A point-to-point link, using both addresses (RFC 3021)
/32255.255.255.25511A single host, or one route to one address

Usable hosts are the addresses less two: the first (the network address) and the last (the broadcast address) cannot be given to a device. /31 and /32 are the exceptions.

Two examples worked by hand#

Example 1: how big is 192.168.10.0/26?

  1. Host bits: 32 − 26 = 6.
  2. Addresses: 2^6 = 64.
  3. The network address is the first, 192.168.10.0. The broadcast address is the last, 192.168.10.63.
  4. Usable hosts: .1 to .62, which is 62.

Example 2: which /26 does 192.168.10.77 belong to?

A /26 divides the last octet into blocks of 64, the size worked out above: 0–63, 64–127, 128–191 and 192–255. The address ends in 77, so it is in the second block.

The block that contains 192.168.10.77
Network addressFirst usableLast usableBroadcast
192.168.10.64/26192.168.10.65192.168.10.126192.168.10.127

A quick check: the network address is the largest multiple of the block size, 64, that does not exceed the address you started with. For 77 that is 64.

Splitting a network into subnets#

Each bit you add to the prefix halves the block. A /24 becomes two /25s, or four /26s, or eight /27s. To split 192.168.10.0/24 into four equal subnets you borrow two host bits and get /26:

192.168.10.0/24 split into four /26 subnets
SubnetRangeUsable hostsBroadcast
192.168.10.0/26.0 to .63.1 to .62.63
192.168.10.64/26.64 to .127.65 to .126.127
192.168.10.128/26.128 to .191.129 to .190.191
192.168.10.192/26.192 to .255.193 to .254.255

Subnets do not have to be the same size. Splitting with variable length subnet masks (VLSM) lets a /24 hold one /25 for a busy segment, one /26 for a department and two /27s for small ones, as long as each block starts on a boundary that is a multiple of its own size. The subnet calculator can split a block into equal parts and checks the arithmetic.

Going the other way

Contiguous, aligned blocks can be summarised into one route. Four consecutive /24s starting at a multiple of four, 192.168.0.0/24 to 192.168.3.0/24, are exactly 192.168.0.0/22. Routers do this constantly, and it is why the internet's routing table has hundreds of thousands of entries rather than billions.

Why subnet at all#

  • Smaller broadcast domains. Broadcast traffic reaches every device in the subnet. Fewer devices, less noise.
  • Separation. Guests, IoT devices, servers and staff can live on different subnets, with the router or firewall deciding what may cross between them.
  • Planning. Subnets that map to floors, teams or roles make addresses easy to reason about, and easy to summarise.
  • Containing faults. A misconfigured device or a broadcast storm stays in its own subnet.

Prefix lengths in IPv6#

The notation is the same and the numbers are bigger. Because IPv6 addresses are 128 bits, the sizes that matter are:

Typical IPv6 prefix sizes
PrefixMeaningNotes
/128One addressThe equivalent of an IPv4 /32
/64One subnetThe standard size for a local network, with 2^64 (18,446,744,073,709,551,616) addresses. Automatic address configuration expects it
/56 or /48A home or site allocationWhat an ISP normally delegates to a customer, so it can have many /64 subnets (RFC 6177)
/32An ISP's allocationThe minimum block a registry normally allocates to a provider

Common questions#

What is a wildcard mask?

The inverse of a subnet mask: ones where the mask has zeros. The wildcard for a /26 is 0.0.0.63. Some router and firewall rule languages use it instead of a prefix length.

What does 0.0.0.0/0 mean?

Every address. In a routing table it is the default route: where to send anything that no more specific entry matches.

Why can't I use the first and last address in a subnet?

They are taken: the first names the subnet itself and the last is the broadcast address for it. Point-to-point /31s and single-host /32s are the exceptions.

Try it on your own connection

Sources and further reading

Keep reading

Published by My IP Address