CCNA Starting Saturday, November 28 | 9:30 AM - 12:30 PM | Now $499 (reg. $699) | Free First Demo Class! Register now

All resources
Study Guide

Subnet Mask Cheat Sheet: CIDR Chart /0 to /32

A subnet mask tells a device which bits of an IPv4 address identify the network. In CIDR notation the number after the slash counts those network bits, so /24 means 255.255.255.0: 256 addresses, 254 of them usable by hosts. The chart below lists every prefix from /32 down to /0 with its dotted mask, wildcard mask and host count.


1. CIDR to Subnet Mask Chart

CIDRSubnet maskWildcard maskAddressesUsable hosts
/32255.255.255.2550.0.0.011 (single host)
/31255.255.255.2540.0.0.122 (point-to-point links)
/30255.255.255.2520.0.0.342
/29255.255.255.2480.0.0.786
/28255.255.255.2400.0.0.151614
/27255.255.255.2240.0.0.313230
/26255.255.255.1920.0.0.636462
/25255.255.255.1280.0.0.127128126
/24255.255.255.00.0.0.255256254
/23255.255.254.00.0.1.255512510
/22255.255.252.00.0.3.2551,0241,022
/21255.255.248.00.0.7.2552,0482,046
/20255.255.240.00.0.15.2554,0964,094
/19255.255.224.00.0.31.2558,1928,190
/18255.255.192.00.0.63.25516,38416,382
/17255.255.128.00.0.127.25532,76832,766
/16255.255.0.00.0.255.25565,53665,534
/15255.254.0.00.1.255.255131,072131,070
/14255.252.0.00.3.255.255262,144262,142
/13255.248.0.00.7.255.255524,288524,286
/12255.240.0.00.15.255.2551,048,5761,048,574
/11255.224.0.00.31.255.2552,097,1522,097,150
/10255.192.0.00.63.255.2554,194,3044,194,302
/9255.128.0.00.127.255.2558,388,6088,388,606
/8255.0.0.00.255.255.25516,777,21616,777,214
/7254.0.0.01.255.255.25533,554,43233,554,430
/6252.0.0.03.255.255.25567,108,86467,108,862
/5248.0.0.07.255.255.255134,217,728134,217,726
/4240.0.0.015.255.255.255268,435,456268,435,454
/3224.0.0.031.255.255.255536,870,912536,870,910
/2192.0.0.063.255.255.2551,073,741,8241,073,741,822
/1128.0.0.0127.255.255.2552,147,483,6482,147,483,646
/00.0.0.0255.255.255.2554,294,967,2964,294,967,294

Usable hosts are the addresses minus the network and broadcast addresses. Two prefixes are exceptions: a /31 gives both addresses to the two ends of a point-to-point link (RFC 3021), and a /32 identifies one host, as in a loopback or host route.

2. Core Formulas

  • Host bits = 32 minus the prefix length.
  • Addresses per subnet = 2 to the power of the host bits.
  • Usable hosts = addresses minus 2 (except /31 and /32).
  • Subnets created = 2 to the power of the bits you borrow from the parent network.
  • Block size = 256 minus the mask value in the interesting octet.
  • Wildcard mask = 255 minus each octet of the subnet mask.

3. Fast Method (do this in your head)

Given an IP address and a mask:

  1. Find the interesting octet, the rightmost mask octet that is not 0 or 255 (for /27 it is the fourth octet, 224).
  2. Block size = 256 minus that value. For /27, 256 minus 224 = 32.
  3. Subnet boundaries are multiples of the block size in that octet: 0, 32, 64, 96, 128, 160, 192, 224.
  4. The host's subnet is the largest boundary that is not above the host's value in that octet.
  5. Network address = that boundary. Broadcast = the next boundary minus 1.
  6. Usable range = network plus 1 up to broadcast minus 1.

4. Worked Examples

Example A: 172.16.45.50/26

  • Mask 255.255.255.192, so the block size is 256 minus 192 = 64.
  • Boundaries: 0, 64, 128, 192. The value 50 falls in the 0 subnet.
  • Network 172.16.45.0, broadcast 172.16.45.63, hosts .1 to .62.

Example B: 10.1.20.130/27

  • Mask 255.255.255.224, block size 32.
  • Boundaries: 0, 32, 64, 96, 128, 160, 192, 224. The value 130 falls in the 128 subnet.
  • Network 10.1.20.128, broadcast 10.1.20.159, hosts .129 to .158.

Example C: 192.168.5.200/29

  • Mask 255.255.255.248, block size 8.
  • 200 sits exactly on a boundary, so it is the network address of 192.168.5.200/29.
  • Broadcast 192.168.5.207, hosts .201 to .206.

Example D: a /30 point-to-point link, 10.10.10.0/30

  • Block size 4, so the subnets are .0, .4, .8, .12 and so on.
  • For the .0 subnet: network .0, broadcast .3, usable hosts .1 and .2.

Example E: splitting 192.168.1.0/24 into two /25s

  • Block size 128.
  • 192.168.1.0/25: hosts .1 to .126, broadcast .127.
  • 192.168.1.128/25: hosts .129 to .254, broadcast .255.

5. VLSM Design (largest subnet first)

A 200-host LAN, a 60-host LAN, a 28-host LAN and a 2-host WAN link will not fit in one /24, because the 200-host LAN alone needs a /24. Start from 10.0.0.0/23 (510 usable addresses) and allocate the largest block first:

SubnetPrefixNetworkBroadcastUsable hosts
200-host LAN/2410.0.0.010.0.0.255.1 to .254
60-host LAN/2610.0.1.010.0.1.63.1 to .62
28-host LAN/2710.0.1.6410.0.1.95.65 to .94
2-host WAN/3010.0.1.9610.0.1.99.97 and .98

Rule of thumb: sort the networks by size, biggest first, then walk through the address space so every block starts on its own boundary.

6. Wildcard Masks (for ACLs and OSPF)

A wildcard mask is the inverse of the subnet mask. For /27 (mask 255.255.255.224) the wildcard is 0.0.0.31. Cisco ACLs and OSPF network statements use it:

access-list 10 permit 192.168.5.32 0.0.0.31 matches 192.168.5.32 to 192.168.5.63.

7. Reserved IPv4 Ranges

BlockRangeUse
10.0.0.0/810.0.0.0 to 10.255.255.255Private (RFC 1918), large networks
172.16.0.0/12172.16.0.0 to 172.31.255.255Private (RFC 1918)
192.168.0.0/16192.168.0.0 to 192.168.255.255Private (RFC 1918), home and small office
169.254.0.0/16169.254.0.0 to 169.254.255.255Link-local (APIPA) when DHCP fails
127.0.0.0/8127.0.0.0 to 127.255.255.255Loopback

8. Common Mistakes to Avoid

  • Confusing the block size with the number of usable hosts: the block includes the network and broadcast addresses.
  • Treating a /31 as unusable: under RFC 3021 both addresses work on a point-to-point link.
  • Putting a subnet mask where an ACL expects a wildcard mask. They are inverses.
  • Counting the broadcast address as a usable host.

Written by CISNET instructors. Print this page (Cmd or Ctrl + P, then Save as PDF) for an offline copy. Work any address with the subnet calculator and build speed with subnetting practice.

Frequently Asked Questions

What is the subnet mask for /24?

255.255.255.0. A /24 has 24 network bits and 8 host bits, so it holds 256 addresses. Removing the network and broadcast addresses leaves 254 usable host addresses, which is why /24 is the usual size for an office LAN.

How do you calculate the number of hosts in a subnet?

Raise 2 to the number of host bits and subtract 2. Host bits are 32 minus the prefix, so a /27 has 5 host bits: 2 to the 5th is 32 addresses and 30 usable hosts. A /31 is the exception, giving 2 usable addresses on point-to-point links under RFC 3021.

What is a wildcard mask?

A wildcard mask is the inverse of a subnet mask, used in Cisco ACLs and OSPF network statements. Subtract each octet of the subnet mask from 255: the /27 mask 255.255.255.224 becomes the wildcard 0.0.0.31, which matches a block of 32 addresses.

What does CIDR notation mean?

CIDR (Classless Inter-Domain Routing) notation writes the mask as a slash and the number of network bits, so 192.168.1.0/24 means the first 24 bits are the network. It replaced the fixed Class A, B and C masks and is defined in RFC 4632.

Use Cmd/Ctrl + P → Save as PDF for an offline copy.