Skip to content
Hopfluent

Reference

CIDR cheat sheet

Every IPv4 prefix length with its subnet mask, wildcard mask and host count. Computed, not typed, so it is right.

IPv4 prefix lengths with subnet mask, wildcard mask, total addresses and usable hosts
PrefixSubnet maskWildcardWildcardAddressesUsable hostsAddresses
/00.0.0.0255.255.255.255255.255.255.2554,294,967,2964,294,967,2944,294,967,296
/1128.0.0.0127.255.255.255127.255.255.2552,147,483,6482,147,483,6462,147,483,648
/2192.0.0.063.255.255.25563.255.255.2551,073,741,8241,073,741,8221,073,741,824
/3224.0.0.031.255.255.25531.255.255.255536,870,912536,870,910536,870,912
/4240.0.0.015.255.255.25515.255.255.255268,435,456268,435,454268,435,456
/5248.0.0.07.255.255.2557.255.255.255134,217,728134,217,726134,217,728
/6252.0.0.03.255.255.2553.255.255.25567,108,86467,108,86267,108,864
/7254.0.0.01.255.255.2551.255.255.25533,554,43233,554,43033,554,432
/8255.0.0.00.255.255.2550.255.255.25516,777,21616,777,21416,777,216
/9255.128.0.00.127.255.2550.127.255.2558,388,6088,388,6068,388,608
/10255.192.0.00.63.255.2550.63.255.2554,194,3044,194,3024,194,304
/11255.224.0.00.31.255.2550.31.255.2552,097,1522,097,1502,097,152
/12255.240.0.00.15.255.2550.15.255.2551,048,5761,048,5741,048,576
/13255.248.0.00.7.255.2550.7.255.255524,288524,286524,288
/14255.252.0.00.3.255.2550.3.255.255262,144262,142262,144
/15255.254.0.00.1.255.2550.1.255.255131,072131,070131,072
/16255.255.0.00.0.255.2550.0.255.25565,53665,53465,536
/17255.255.128.00.0.127.2550.0.127.25532,76832,76632,768
/18255.255.192.00.0.63.2550.0.63.25516,38416,38216,384
/19255.255.224.00.0.31.2550.0.31.2558,1928,1908,192
/20255.255.240.00.0.15.2550.0.15.2554,0964,0944,096
/21255.255.248.00.0.7.2550.0.7.2552,0482,0462,048
/22255.255.252.00.0.3.2550.0.3.2551,0241,0221,024
/23255.255.254.00.0.1.2550.0.1.255512510512
/24255.255.255.00.0.0.2550.0.0.255256254256
/25255.255.255.1280.0.0.1270.0.0.127128126128
/26255.255.255.1920.0.0.630.0.0.63646264
/27255.255.255.2240.0.0.310.0.0.31323032
/28255.255.255.2400.0.0.150.0.0.15161416
/29255.255.255.2480.0.0.70.0.0.7868
/30255.255.255.2520.0.0.30.0.0.3424
/31255.255.255.2540.0.0.10.0.0.1222
/32255.255.255.2550.0.0.00.0.0.0111

Reading the table

  • Highlighted rows fall on octet boundaries: /8, /16 and /24 are the easy ones to remember.
  • Each extra prefix bit halves the number of addresses. Each bit removed doubles it.
  • Usable hosts is the total minus two, for the network and broadcast addresses. The exceptions are /31, where both addresses work on a point-to-point link (RFC 3021), and /32, which is a single host.
  • The wildcard mask is the subnet mask inverted. Access lists use it.

Private address ranges

  • 10.0.0.0/8: 10.0.0.0 to 10.255.255.255
  • 172.16.0.0/12: 172.16.0.0 to 172.31.255.255
  • 192.168.0.0/16: 192.168.0.0 to 192.168.255.255

These are set aside by RFC 1918. Need the numbers for a specific address? Use the subnet calculator.

Common questions

What does the number after the slash mean?+

It is the prefix length: how many of the address's 32 bits identify the network. The remaining bits number the hosts. A /24 has 24 network bits and 8 host bits.

How do I convert a prefix length to a subnet mask?+

Write that many 1 bits from the left, fill the rest with 0, and read each group of eight bits as a number. /26 is 26 ones and 6 zeros, which is 255.255.255.192.

How many hosts are in a /24?+

A /24 has 256 addresses. Two are reserved for the network and broadcast addresses, which leaves 254 usable hosts.

Which ranges are private?+

RFC 1918 reserves 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16 for private networks. They are not routed on the public internet.