AP Networking • IPv4 Subnetting & Routing

CIDR Notation Explained

Understand what the slash number really means, convert prefixes to masks, calculate block boundaries, decide local vs. remote behavior, and read route tables using longest-prefix matching.

Independent AP Networking resource • Updated 2026-09-10 • Includes 24 free digital flashcards
CIDR rule: the slash number counts leading network bits; everything else follows from that bit boundary.
Practice with Flashcards
Core model

CIDR notation tells you exactly where the network portion stops and the host portion begins

Classless Inter-Domain Routing notation writes an IPv4 address followed by a slash and a prefix length, such as 192.168.1.25/24. The slash number counts the number of leading network bits. The remaining bits identify positions inside that network. That one number drives subnet size, address boundaries, host capacity, local-vs-remote decisions, and route specificity.

CIDR reasoning chain: Address/Prefix → Network Bits → Host Bits → Mask → Block Size → Network Boundary → Local/Remote Decision → Route Specificity.
Slash number

/24 means 24 network bits—not 24 hosts

IPv4 addresses contain 32 bits. A /24 reserves the first 24 bits for the network prefix and leaves 8 host bits. A /26 reserves 26 network bits and leaves 6 host bits. As the slash number gets larger, fewer host bits remain, so the subnet becomes smaller.

/24 → 24 network bits + 8 host bits /26 → 26 network bits + 6 host bits /30 → 30 network bits + 2 host bits

This is the first distinction to master because nearly every other CIDR calculation follows from it.

Prefix math

Every additional prefix bit halves the address block

A /24 leaves 8 host bits, so it contains 2^8 = 256 total addresses. A /25 leaves 7 host bits and contains 128. /26 contains 64. /27 contains 32. The pattern continues by halving each time the prefix increases by one.

PrefixHost bitsTotal addressesTraditional usable hosts
/248256254
/257128126
/2666462
/2753230
/2841614
/29386
/30242

Swipe horizontally to see the CIDR capacity table.

CIDR to subnet mask

Write leading 1s to convert a prefix into dotted decimal

A subnet mask contains 1s for network bits and 0s for host bits. Every full octet of eight 1s becomes 255. A partial octet uses one of a small set of values.

/27 mask bits: 11111111.11111111.11111111.11100000 Decimal: 255.255.255.224
Leading 1s in partial octetBinaryDecimal
110000000128
211000000192
311100000224
411110000240
511111000248
611111100252
711111110254

Swipe horizontally to see the partial-octet table.

Common masks

Know the /24 through /30 sequence

/24

255.255.255.0

/25

255.255.255.128

/26

255.255.255.192

/27

255.255.255.224

/28

255.255.255.240

/29

255.255.255.248

/30

255.255.255.252

Block size

The mask reveals how far subnet boundaries advance

For a /26, the last-octet mask is 192. The block size is 256 − 192 = 64. That produces boundaries at .0, .64, .128, and .192. For /27, 256 − 224 = 32, so blocks begin at .0, .32, .64, .96, and so on.

/26: 256 - 192 = 64 Blocks: .0, .64, .128, .192 /27: 256 - 224 = 32 Blocks: .0, .32, .64, .96, .128...
Worked boundary example

172.16.8.70/27 belongs to 172.16.8.64/27

A /27 has a block size of 32. The final-octet blocks are 0–31, 32–63, 64–95, 96–127, and so on. Since 70 falls between 64 and 95, the network is .64.

Address: 172.16.8.70/27 Network: 172.16.8.64 First host: 172.16.8.65 Last host: 172.16.8.94 Broadcast: 172.16.8.95

This same calculation tells the host which destinations are local.

Local vs. remote

The prefix determines whether a host uses ARP locally or sends traffic to the gateway

Suppose 172.16.8.70/27 wants to reach 172.16.8.90. Both addresses fall inside 172.16.8.64/27, so the destination is local. The sender can resolve the destination's Layer 2 address directly.

Now try 172.16.8.100. That address belongs to the next /27 block, so the sender treats it as remote and forwards the packet toward its default gateway.

CIDR is behavior: the same destination can be considered local or remote depending on the source host's prefix.
Route prefixes

Routers use CIDR notation to describe destination ranges

A route such as 10.20.0.0/16 covers a broad range. A route for 10.20.30.0/24 covers a smaller, more specific range inside it. If a destination matches both, routers generally choose the route with the longest matching prefix.

Route A: 10.20.0.0/16 Route B: 10.20.30.0/24 Destination: 10.20.30.55 Both match. Longest prefix = /24 Choose Route B.
Longest-prefix matching

Specificity is checked before route metric among overlapping prefixes

A common mistake is to compare route metrics before checking which prefixes actually match most specifically. A /24 route is more specific than a /16. A /32 host route is more specific than either. The default route /0 is the least specific possible IPv4 route.

PrefixSpecificityTypical meaning
/32Most specific in this listSingle host
/24More specific256-address block
/16Broader65,536-address block
/0Least specificDefault route

Swipe horizontally to see the specificity table.

Default route

0.0.0.0/0 matches every IPv4 destination, but only when no more-specific route wins

The /0 prefix contains zero fixed network bits. That means every IPv4 address matches it. It is useful as a catch-all route toward an upstream gateway or Internet edge.

The default route does not override specific routes. It is selected when the route table has no more-specific match for the destination.

Route aggregation

A broader prefix can summarize multiple contiguous aligned networks

CIDR made route aggregation practical. Instead of advertising many smaller routes separately, a router can sometimes advertise one broader prefix when the included networks share the required leading bits.

192.168.0.0/24 192.168.1.0/24 These two contiguous aligned /24s can be summarized as: 192.168.0.0/23

The summary must begin on the correct binary boundary. Similar-looking decimal addresses are not automatically aggregatable.

Aggregation evidence boundary

A summary route should cover all intended networks—and no unintended range unless that is deliberate

If you summarize too broadly, the router may attract traffic for networks that do not actually exist behind it. That can produce black holes or confusing forwarding behavior.

Do not summarize by visual similarity alone. Verify that the leading binary bits align for the proposed prefix.
Worked case 1

A /26 address is misclassified because someone assumes every subnet starts at .0

Address 192.168.10.150/26 does not belong to 192.168.10.0/26. /26 blocks advance by 64: .0, .64, .128, .192.

150 falls in .128-.191 Network: 192.168.10.128 Broadcast: 192.168.10.191

The slash length defines the block. The written address does not tell you the boundary by itself.

Worked case 2

A host treats .90 as local but .100 as remote under /27

Host 172.16.8.70/27 belongs to .64-.95. Address .90 is inside that range, so it is local. Address .100 is outside, so the packet goes to the default gateway.

This connects CIDR directly to ARP and routing behavior.

Worked case 3

A router chooses /24 over /16 even when the /16 route has a lower metric

Destination 10.20.30.55 matches both 10.20.0.0/16 and 10.20.30.0/24. The /24 is more specific, so it is considered before comparing metrics with routes to different prefix lengths.

This is why longest-prefix matching must come before general route-cost intuition.

Worked case 4

A /23 summary can represent two aligned /24 networks

192.168.0.0/24 and 192.168.1.0/24 are contiguous and aligned on the /23 boundary. Their shared leading bits allow the summary 192.168.0.0/23.

But 192.168.1.0/24 and 192.168.2.0/24 do not form a single aligned /23 summary beginning at .1.

Worked case 5

A larger slash number creates a smaller subnet

A student says /28 is larger than /24 because 28 is numerically larger. In reality, /28 leaves only 4 host bits, while /24 leaves 8. /28 has 16 total addresses; /24 has 256.

★ Addressing Practice • CIDR Notation Explained

A five-minute warm-up for CIDR Notation Explained

Tomorrow’s opening question can pick up where this page leaves off: ask students to explain the idea in their own words and apply it to a real network. The 300 Bell Ringers give you short questions and teacher answers you can use without preparing a new starter each morning.

300 AP Networking Bell Ringers
$74.99
BUY TEACHER PACK → See what is included in the 300 Bell Ringers →
Instant Access • Full-Year Teacher Resource

The slash number counts fixed network bits, not subnet size.

CIDR vs. dotted mask

Both formats describe the same bit boundary

CIDRDotted maskHost bitsTotal addresses
/24255.255.255.08256
/26255.255.255.192664
/27255.255.255.224532
/30255.255.255.25224

Swipe horizontally to see the comparison.

Binary cross-check

Use binary when the decimal boundary feels ambiguous

For 192.168.10.150/26, the final octet 150 is binary 10010110. A /26 fixes the first two bits of that final octet because the first 24 bits already occupy the first three octets.

150 = 10010110 /26 mask final octet = 11000000 Network bits: 10xxxxxx Lowest value = 10000000 = 128 Highest value = 10111111 = 191

Binary reveals why the network block is .128-.191.

CIDR and host count

Host capacity is a direct consequence of how many bits CIDR leaves unfixed

If a /27 leaves 5 host bits, those bits create 32 combinations. In the traditional LAN model, network and broadcast consume two combinations, leaving 30 usable host addresses.

For full capacity calculations, continue to How Many Hosts Per Subnet?.

Addressing & Subnetting Lab • 120 Missions

Let students try CIDR Notation Explained for themselves

Reading the explanation is a start. In the browser simulator, students work through a broken network, choose what to test and see whether their fix worked. It gives them another chance to use what they learned about CIDR Notation Explained.

AP Networking Browser Troubleshooting Simulator
$29.99
120 Missions • 60 Failure Patterns • Offline Copy
GET THE SIMULATOR → See all 120 missions & features
Special prefixes

/31 and /32 show why CIDR should be understood as bit boundaries, not memorized host formulas

A /31 leaves one host bit and can be used on point-to-point links under modern standards. A /32 fixes all 32 bits and identifies one exact host route/address.

The traditional “subtract two” host formula belongs to ordinary multi-host subnet calculations, not every possible prefix context.

Common CIDR mistakes

Most errors come from confusing prefix length with block size or route meaning

MistakeWhy it failsBetter rule
/24 means 24 hostsSlash counts network bitsHost bits = 32 − prefix
/28 is larger than /24More network bits leave fewer host bitsLarger prefix = smaller subnet
Every /26 begins at .0There are four /26 blocks inside a /24Use block-size boundaries
Lowest metric always winsLongest prefix is considered firstFind most-specific match first

Swipe horizontally to see the mistake table.

CIDR troubleshooting scenario

A wrong prefix can make a host send traffic to the wrong place

Suppose Host A is 192.168.10.70/27 and the intended gateway is 192.168.10.65. Host B is 192.168.10.100. With /27, Host A correctly treats Host B as remote and sends the packet to the gateway.

If Host A is accidentally configured /24, it now believes .100 is local and tries to resolve it directly with ARP. If no Layer 2 path exists between the actual subnets, communication fails even though the gateway is healthy.

Addressing Exam Practice • CIDR Notation Explained

Check whether CIDR Notation Explained has really stuck

Once students have worked through this topic, give them questions mixed in with the rest of the course. The Exam Prep Vault includes practice exams, multiple-choice questions and artifact labs so they cannot rely on a chapter heading to tell them what to do.

AP Networking Complete Exam Prep Vault
$39.99
GET THE EXAM PREP VAULT → See the Exam Prep Vault contents →
4 Practice Exams • 320 MCQs • 60 Artifact Labs
CIDR misconfiguration changes forwarding behavior before routing even begins.
Route-table interpretation drill

Choose the route by longest matching prefix

10.0.0.0/8 → GW-A 10.20.0.0/16 → GW-B 10.20.30.0/24 → GW-C 0.0.0.0/0 → GW-D Destination 10.20.30.55 → GW-C Destination 10.20.40.10 → GW-B Destination 10.50.1.1 → GW-A Destination 8.8.8.8 → GW-D

This drill makes CIDR useful beyond subnetting arithmetic.

Exam-speed method

Use the shortest reliable sequence under time pressure

1. Prefix: identify slash length.

2. Host bits: 32 − prefix.

3. Mask/block: convert partial octet or use known block size.

4. Boundary: locate the address inside the correct subnet block.

5. Behavior: decide local vs. remote or route specificity.

6. Verify: cross-check capacity or binary boundary if needed.

CIDR boundary ladder

The same prefix creates repeating boundaries across the octet

Once you know the block size, you can write the valid network starts without converting every address to binary. A /27 has a block size of 32, so the boundaries in the final octet are 0, 32, 64, 96, 128, 160, 192, and 224. A /28 has a block size of 16, so its boundaries occur twice as often.

Premium Routing Feedback

Spend less time marking explanations about CIDR Notation Explained

When students explain their answer, it takes more than a right-or-wrong check to see what they understand. The Grading Copilot helps you review how they used the clues, where their explanation falls short and what feedback to give next. You make the final grading decision.

AP Networking Artifact Analysis Grading Copilot
$49.99
8 Criteria • 5 Task Modes • Offline Premium Copy
GET THE GRADING COPILOT → See the free Copilot preview
/27 boundaries: 0, 32, 64, 96, 128, 160, 192, 224 /28 boundaries: 0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192, 208, 224, 240

This gives you a fast test: the network address must be one of the valid block starts for that prefix. If someone claims 192.168.10.70/27 belongs to 192.168.10.70/27 as the network, that is immediately wrong because 70 is not a /27 boundary.

Prefix comparison

Two hosts can use the same IP range differently when their prefixes differ

Consider Host A at 192.168.10.70/27 and Host B at 192.168.10.100/24. Host A sees .100 as remote because .70/27 belongs to the .64-.95 subnet. Host B sees .70 as local because /24 covers .0-.255.

Host A: 192.168.10.70/27 Local range: .64-.95 Destination .100 → remote → gateway Host B: 192.168.10.100/24 Local range: .0-.255 Destination .70 → local → ARP

This asymmetry can produce confusing failures when one endpoint has the wrong mask. One host sends toward the gateway while the other expects direct Layer 2 delivery. CIDR therefore affects forwarding behavior on each endpoint independently.

NEW • COMPLETE 180-DAY TEACHER CURRICULUM

Teach CIDR Notation Explained as part of a planned school year

This page gives you one topic. The 180-Day Teacher Curriculum puts it into a full course plan, with daily teaching notes, student activities and checks for understanding. Use it when you need to know what comes before this lesson and what to teach next.

AP Networking Complete 180-Day Teacher Curriculum
$199.99
180 Lessons • 180 Daily Simulators • 36 Teaching Weeks
GET THE 180-DAY CURRICULUM → See 3 free curriculum examples
Route overlap analysis

Overlapping prefixes are normal when they express increasing specificity

A route table can contain a default route, a broad organizational route, a subnet route, and a host route at the same time. These entries do not conflict merely because they overlap. Longest-prefix matching provides a deterministic selection rule.

0.0.0.0/0 → Internet 10.0.0.0/8 → Corporate WAN 10.20.0.0/16 → Campus B 10.20.30.0/24 → Building 30 10.20.30.55/32 → Special host path

Traffic to 10.20.30.55 selects the /32. Traffic to 10.20.30.80 selects the /24. Traffic to 10.20.40.10 selects the /16. This is a useful way to connect subnetting knowledge directly to routing-table analysis.

CIDR verification strategy

Cross-check the answer using mask, block size, and binary when needed

When the problem matters enough to verify, use more than one method. Convert the prefix to a mask, calculate the block size from the partial octet, and confirm the binary boundary. These methods should converge on the same answer.

Example: 192.168.10.150/26 Mask: 255.255.255.192 Block size: 256 - 192 = 64 Valid starts: 0, 64, 128, 192 150 lies in 128-191 Binary: 150 = 10010110 Mask = 11000000 Network bits = 10xxxxxx Network = 128

If one method gives .128 and another gives .64, stop and fix the arithmetic before using the result in a routing or host-capacity decision.

Free digital flashcards

24 CIDR Notation digital flashcards

Practice prefix lengths, host bits, subnet masks, block sizes, address boundaries, longest-prefix matching, default routes, aggregation, local-vs-remote behavior, and common exam traps.

All CIDR cards
Click or press Enter/Space to reveal.
State what the prefix changes in the address or route.
0 seen•24 cards
Continue studying

Connect CIDR to subnetting, IP addressing, routing, and troubleshooting