IPv4 Subnetting Practice Tool - Test Your Network Skills

🎯

IPv4 Subnetting Practice

Generate a random network, calculate all subnet values, then check your answers row by row or all at once

🎲 Target Network

. . . /

📝 Your Answers

Field
Your Answer
Status
Correct Answer
IP Class
Network
. . .
. . .
Subnet Mask
. . .
. . .
First Host
. . .
. . .
Last Host
. . .
. . .
Broadcast
. . .
. . .
Next Subnet
. . .
. . .

How to Master IPv4 Subnetting Calculations

Online calculators and tools like the IPv4 Subnetting Practice quiz above are invaluable for verifying your work, but passing industry certifications such as Cisco CCNA, CompTIA Network+, and CompTIA Security+ requires something the calculator cannot give you: the ability to perform fast, confident, and accurate subnetting arithmetic entirely in your head — or on a single sheet of scratch paper — under exam-room time pressure. Every CCNA exam question that involves a subnet typically needs to be answered in under 60 seconds.

The method taught in this guide — the Magic Number (Block Size) technique — is the fastest path from a raw IPv4 address and CIDR prefix to all five critical subnet values, and it is the same technique that experienced network engineers use during live troubleshooting when they need an instant answer.

Step 1: Identifying the IP Class

Before you perform any arithmetic, you must classify the IP address using its first octet. Classical IP addressing divides the 32-bit address space into ranges that determine the default network boundary and, most importantly for the exam, the single-letter class answer that the practice tool asks you to identify instantly. The three routable unicast classes you must memorise are as follows: Class A covers first-octet values from 1 to 126 and uses a default mask of 255.0.0.0 (/8), giving each Class A network over 16 million host addresses.

Class B covers first-octet values from 128 to 191 with a default mask of 255.255.0.0 (/16), providing 65,534 usable hosts per network. Class C covers first-octet values from 192 to 223 with a default mask of 255.255.255.0 (/24), the most common range in CCNA practice questions. Additionally, Class D (224–239) is reserved for multicast and Class E (240–255) is reserved for experimental use — neither class is assigned to host interfaces.

Note that 127.x.x.x is the loopback range and is intentionally excluded from Class A routing.

Memorisation Tip: Use the boundary numbers 128 and 192 as your mental fence posts. Any address below 128 is Class A, anything from 128 to 191 is Class B, and anything from 192 to 223 is Class C. If you can read the first octet, you can state the class in under one second.

Step 2: The Magic Number (Block Size)

The single most powerful mental shortcut in all of IPv4 subnetting is the Magic Number, also called the Block Size. It is calculated with one simple formula: Magic Number = 256 − (Subnet Mask value in the Interesting Octet). The Interesting Octet is the octet of the subnet mask that is neither 255 (fully masked) nor 0 (fully open) — it is the octet where the subnet boundary actually falls. For example, if your CIDR prefix is /25, the subnet mask is 255.255.255.128. The interesting octet is the fourth octet, which contains the value 128.

The magic number is therefore 256 − 128 = 128

. This single number of 128 tells you the size of every subnet block in that octet — every valid subnet network address must be a multiple of 128 in that octet (i.e., 0, 128, 256...). For a /26 mask of 255.255.255.192, the magic number is 256 − 192 = 64

, meaning subnets start at 0, 64, 128, 192 in the fourth octet.

For a /23 mask of 255.255.254.0, the interesting octet is the third octet with a value of 254, giving a magic number of 256 − 254 = 2

, and subnets increment by 2 in the third octet.

  • /24 → mask 255.255.255.0 → Magic Number: 256 − 0 = 256 (the entire fourth octet is the host space; there is only one subnet in that third-octet block).

  • /25 → mask 255.255.255.128 → Magic Number: 256 − 128 = 128 (two subnets per /24 block, each holding 126 usable hosts).

  • /26 → mask 255.255.255.192 → Magic Number: 256 − 192 = 64 (four subnets per /24, each holding 62 usable hosts).

  • /27 → mask 255.255.255.224 → Magic Number: 256 − 224 = 32 (eight subnets per /24, each holding 30 usable hosts).

  • /28 → mask 255.255.255.240 → Magic Number: 256 − 240 = 16 (sixteen subnets per /24, each holding 14 usable hosts).

  • /30 → mask 255.255.255.252 → Magic Number: 256 − 252 = 4 (the classic point-to-point prefix, with only 2 usable host addresses per subnet).

Step 3: Calculating the 5 Key Values

Once you have the magic number in hand, all five values the practice tool tests you on fall out of a single, repeatable sequence. Work through the following steps every time, in exactly this order, and you will never have to memorise a formula beyond the magic number itself.

① Network Address — Find the nearest multiple of the magic number at or below the interesting octet of the host IP. Take the value in the interesting octet of the host address and round it down to the nearest multiple of the magic number. Every other octet to the left is copied exactly from the original IP, and every other octet to the right is set to zero. For example, with the address 203.248.112.46/25 and a magic number of 128: the fourth octet of the host is 46. The multiples of 128 are 0 and 128. Since 46 falls between 0 and 128, we round down to 0.

The Network Address is therefore 203.248.112.0

.

② Next Subnet — Add the magic number to the Network Address in the interesting octet. This is trivially simple: Next Subnet = Network Address + Magic Number (in the interesting octet only). In our example: 0 + 128 = 128

, so the Next Subnet is 203.248.112.128

. If adding the magic number causes the interesting octet to exceed 255, you carry 1 into the next octet to the left, exactly as ordinary addition.

③ Broadcast Address — Subtract 1 from the Next Subnet in the interesting octet. The broadcast address is the last address in the current subnet block — every bit in the host portion is set to 1. Rather than converting binary, simply use the shortcut: Broadcast = Next Subnet − 1 in the interesting octet, with all octets to the right set to 255. In our example: 128 − 1 = 127

, so the Broadcast is 203.248.112.127

.

For a prefix that cuts through a non-final octet (e.g., /23), the octets to the right of the interesting octet also become 255.

④ First Host — Add 1 to the Network Address in the last (rightmost) octet. The Network Address itself is reserved and cannot be assigned to any device. The very next address is the first assignable host: First Host = Network Address + 1. In our example: 203.248.112.0 + 1 = 203.248.112.1

.

⑤ Last Host — Subtract 1 from the Broadcast Address in the last octet. The Broadcast Address is also reserved and cannot be assigned. The address immediately before it is the last assignable host: Last Host = Broadcast − 1. In our example: 203.248.112.127 − 1 = 203.248.112.126

.

The Complete Example at a Glance — Given 203.248.112.46/25: Magic Number = 128. Network = 203.248.112.0. Next Subnet = 203.248.112.128. Broadcast = 203.248.112.127. First Host = 203.248.112.1. Last Host = 203.248.112.126. Total usable hosts = 27 − 2 = 126. This entire calculation should take under 30 seconds once you have practised it 20–30 times with the quiz tool above.

Subscribe
Notify of
guest

0 Corrections & Clarifications