Skip to content

Practical technology help for homes and small businesses, from someone who knows how to make it work. Based in Martinez, serving Contra Costa County.

Practical IT guides, cheatsheets, and references from Jeremiah Ellington, drawn from more than 20 years of IT work in public sector and higher education.

Contact Info
Location Martinez, CA (Serving Contra Costa County)
Contact Info
Location Martinez, CA (Serving Contra Costa County)

Cheatsheet

Mental Subnetting Cheatsheet

One printable page for subnetting IPv4 without a chart: the four steps, the interesting octet for each prefix, mask values and increments, powers of two, and /0, /31 and /32.

  • Applies to: IPv4 CIDR prefixes /0 to /32. IPv6 isn't covered
  • Last reviewed

Free, no email required.

Ask AI about this cheatsheetChatGPT, Claude, or any assistant

These open a new chat with a prompt that points the assistant to this cheatsheet. It only sees the cheatsheet if it can open the link. If it says it can't, use Copy cheatsheet for AI and paste the text into the chat.

Nothing goes to an AI service unless you choose one. AI answers can be wrong: check them against the cheatsheet before you change anything important.

The full explanation, with worked examples, is in Subnetting in Your Head. Practice with the Mental Subnetting Trainer; check answers with the IPv4 Subnet Calculator. Examples use documentation and private addresses.

The method is inspired by an explanation u/nivekami posted on r/ccna. This cheatsheet is written independently, in its own words, and isn't endorsed by that author.

The four steps#

  1. Interesting octet: the octet the prefix ends in (table below). Copy the octets before it.
  2. Increment: 2 to the power of the host bits left in that octet, which is 256 minus the mask value there.
  3. Block: round the address's value in that octet down to a multiple of the increment. The block ends at start + increment − 1.
  4. Fill in: network = block start, then 0 in every later octet. Broadcast = block end, then 255 in every later octet. Usable hosts are in between.

Example: 172.23.23.18/22 is the third octet, increment 4, 23 rounds down to 20, so the network is 172.23.20.0/22 and the broadcast is 172.23.23.255.

Which octet#

PrefixInteresting octetCopy unchangedFill with 0s / 255s
/1 to /8firstnonesecond, third, fourth
/9 to /16secondfirstthird, fourth
/17 to /24thirdfirst, secondfourth
/25 to /32fourthfirst threenone

Mask values and increments#

Bits in the octetMask valueIncrementPrefixes
1128128/1, /9, /17, /25
219264/2, /10, /18, /26
322432/3, /11, /19, /27
424016/4, /12, /20, /28
52488/5, /13, /21, /29
62524/6, /14, /22, /30
72542/7, /15, /23, /31
82551/8, /16, /24, /32

With 8 bits, the prefix is octet-aligned: copy the octet as it is.

Powers of two#

Total addresses in a subnet = 2 to the power of (32 − prefix).

Host bitsAddressesPrefix
01/32
12/31
24/30
38/29
416/28
532/27
664/26
7128/25
8256/24
101,024/22
124,096/20
1665,536/16
201,048,576/12
224,194,304/10
2416,777,216/8
324,294,967,296/0

Special prefixes#

PrefixTotalUsableNotes
/3042Network, two hosts, broadcast
/3122Point-to-point link (RFC 3021): no network or broadcast address
/3211Single-address route: host routes, loopbacks
/04,294,967,296Not meaningfulDefault route: 0.0.0.0 to 255.255.255.255

Conventional usable hosts = total − 2, from /1 to /30 only; at /0 the count isn't meaningful.

Watch for#

  • A host address isn't the network ID: 192.168.4.20/28 is a host on 192.168.4.16/28.
  • Fill every octet after the interesting one, not just the last.
  • Round down, never to the nearest multiple.
  • "How many subnets?" needs a parent prefix: a /24 holds 4 /26s; a /22 holds 16.
  • "Subnet 3" needs a parent range and a starting count (0 or 1).

Sources and official documentation

Review history

  • Technical review: Jeremiah Ellington,
  • Editorial review: Jeremiah Ellington,
  • Next scheduled review:

Spotted something out of date or wrong? Email a correction and I'll fix it. See how these guides are made.