In IPv4 CIDR, /n means that the first n of 32 bits are the network prefix. The equivalent subnet mask has n contiguous one-bits followed by 32 - n zero-bits. Therefore /26 is 255.255.255.192 and contains 2^(32-26) = 64 addresses; 192.0.2.130/26 belongs to network 192.0.2.128 with last address 192.0.2.191. A prefix is not a usable-host count and does not prove reachability.

CIDR to subnet mask quick table

Common IPv4 pairs and total block sizes are: /8 = 255.0.0.0 = 16,777,216 addresses; /16 = 255.255.0.0 = 65,536; /20 = 255.255.240.0 = 4,096; /24 = 255.255.255.0 = 256; /25 = 255.255.255.128 = 128; /26 = 255.255.255.192 = 64; /27 = 255.255.255.224 = 32; /28 = 255.255.255.240 = 16; /29 = 255.255.255.248 = 8; /30 = 255.255.255.252 = 4; /31 = 255.255.255.254 = 2; /32 = 255.255.255.255 = 1. These are total addresses, not a promise of usable hosts.

Convert a prefix or mask without guessing

For CIDR to mask, write 255 for every complete group of eight prefix bits. In the next octet, 0 through 8 leading one-bits equal 0, 128, 192, 224, 240, 248, 252, 254, or 255; all later octets are zero. Thus /27 is three full octets plus three one-bits: 255.255.255.224. For mask to CIDR, first require one uninterrupted run of ones followed only by zeros, then count the ones: 255.255.255.224 has 8 + 8 + 8 + 3 = 27 and is /27.

A valid mask is one contiguous boundary

A /26 mask has 26 one-bits followed by six zero-bits: 11111111.11111111.11111111.11000000, or 255.255.255.192. A dotted mask can be converted back to CIDR only when all ones precede all zeroes. A pattern such as 255.0.255.0 is not a subnet mask because the boundary restarts.

Masking finds the start of the block

Bitwise AND between 192.0.2.130 and the /26 mask clears the six host bits, producing network 192.0.2.128. The inverse mask, or wildcard 0.0.0.63, sets the possible host bits. OR-ing it with the network gives the last address 192.0.2.191. This same unsigned arithmetic works for every prefix from /0 through /32.