LightAtom

Subnet Cheat Sheet (CIDR, Masks, Host Counts)

Every IPv4 prefix length on one page: subnet mask, wildcard, total and usable addresses, and how it compares with a /24.

A subnet cheat sheet maps each CIDR prefix length to its subnet mask and size. A /24 is 255.255.255.0 with 256 addresses (254 usable); each step down halves the block, so a /25 has 128 and a /26 has 64. Usable hosts are the total minus two, for the network and broadcast addresses.

How it works

An IPv4 address split into a network part and a host part by the subnet mask.

Quick rules

  • Addresses in a block = 2^(32 − prefix). A /26 has 2^6 = 64.
  • Usable hosts = addresses − 2 (network and broadcast), except /31 (2 usable, for point-to-point links, RFC 3021) and /32 (a single host).
  • Mask octet values are always one of 0, 128, 192, 224, 240, 248, 252, 254, 255.
  • Block size in the interesting octet = 256 − mask value. Mask 255.255.255.224 → blocks of 32: .0, .32, .64…
  • The wildcard mask (used in ACLs and OSPF) is the mask inverted: 255 − each octet.

Common home and office sizes

  • /24 (255.255.255.0): the default home network, 254 devices.
  • /23 or /22: larger offices, 510 or 1,022 hosts.
  • /30 or /31: links between two routers.
  • /16 (255.255.0.0): a whole private range like 172.16.0.0/16, usually split further.

IPv4 subnet chart

PrefixSubnet maskWildcardAddressesUsable hostsSize vs /24
/32255.255.255.2550.0.0.0111/256 of a /24
/31255.255.255.2540.0.0.1221/128 of a /24
/30255.255.255.2520.0.0.3421/64 of a /24
/29255.255.255.2480.0.0.7861/32 of a /24
/28255.255.255.2400.0.0.1516141/16 of a /24
/27255.255.255.2240.0.0.3132301/8 of a /24
/26255.255.255.1920.0.0.6364621/4 of a /24
/25255.255.255.1280.0.0.1271281261/2 of a /24
/24255.255.255.00.0.0.2552562541 × /24
/23255.255.254.00.0.1.2555125102 × /24
/22255.255.252.00.0.3.2551,0241,0224 × /24
/21255.255.248.00.0.7.2552,0482,0468 × /24
/20255.255.240.00.0.15.2554,0964,09416 × /24
/19255.255.224.00.0.31.2558,1928,19032 × /24
/18255.255.192.00.0.63.25516,38416,38264 × /24
/17255.255.128.00.0.127.25532,76832,766128 × /24
/16255.255.0.00.0.255.25565,53665,534256 × /24
/15255.254.0.00.1.255.255131,072131,070512 × /24
/14255.252.0.00.3.255.255262,144262,1421,024 × /24
/13255.248.0.00.7.255.255524,288524,2862,048 × /24
/12255.240.0.00.15.255.2551,048,5761,048,5744,096 × /24
/11255.224.0.00.31.255.2552,097,1522,097,1508,192 × /24
/10255.192.0.00.63.255.2554,194,3044,194,30216,384 × /24
/9255.128.0.00.127.255.2558,388,6088,388,60632,768 × /24
/8255.0.0.00.255.255.25516,777,21616,777,21465,536 × /24

Examples

  • 192.168.1.0/24: network 192.168.1.0, hosts .1–.254, broadcast 192.168.1.255.
  • 10.0.0.64/26: block size 64, hosts 10.0.0.65–10.0.0.126, broadcast 10.0.0.127.
  • Splitting a /24 into four: four /26s at .0, .64, .128 and .192, each with 62 usable hosts.

On a Mac

ifconfig en0 | grep 'inet ' shows your mask in hex: 0xffffff00 is 255.255.255.0, a /24. ipcalc (via Homebrew) and the subnet calculator below do the arithmetic for any network.

Try it

Try: , ,

Network address
192.168.1.0
Broadcast address
192.168.1.255
Usable host range
192.168.1.1 – 192.168.1.254
Usable hosts
254
Total addresses
256
Subnet mask
255.255.255.0
Wildcard mask
0.0.0.255
CIDR notation
192.168.1.0/24
Binary mask
11111111.11111111.11111111.00000000
IP class
C
Type
Private (RFC 1918)

See it in the app

LightAtom's Map tells local-network connections apart from internet ones using your subnet.

Download the printable PDF

Frequently asked questions

What is the subnet mask for /24?

255.255.255.0, giving 256 addresses and 254 usable hosts.

How many hosts are in a /27?

32 addresses, 30 usable hosts. Mask 255.255.255.224.

How do I calculate usable hosts?

2 to the power of (32 minus the prefix length), minus 2. For /28: 2^4 − 2 = 14.

What is a wildcard mask?

The inverse of the subnet mask, used by router ACLs and OSPF: /24's wildcard is 0.0.0.255.

Why does /31 have 2 usable hosts?

RFC 3021 allows /31s on point-to-point links, where no network or broadcast address is needed.

LightAtom team

The people who build LightAtom, a network monitor for macOS.