An IP address by itself tells you "who" a device is. What crucial piece of information does the subnet mask add?
The MAC (hardware) address of the device
Which bits identify the network versus the individual host
The speed of the physical link
The domain name that maps to the address
In a subnet mask, what does a bit set to 1 signify about the corresponding bit of the IP address?
That bit belongs to the host portion
That bit belongs to the network portion
That bit is always ignored by routers
That bit must be flipped before use
Which of the following is a valid subnet mask, given that masks must be contiguous?
11111111.00000000.11111111.00000000
11111111.11111111.11100000.00000000
10101010.11111111.00000000.00000000
00000000.11111111.11111111.11111111
Why are the mask 255.255.255.0 and the CIDR notation /24 considered two ways of writing the same fact?
Because 255 divided by 24 equals a whole number
Because /24 counts the 24 one-bits in the mask
Because both describe a wildcard mask
Because 24 is the number of usable hosts in the block
Why does the value 255 appear so often in subnet masks?
Because 255 is the largest IP address value allowed
Because 255 is a special reserved routing number
Because 255 is what an octet equals when all 8 of its bits are set to 1
Because 255 marks the broadcast address of every network
What a Mask Does
Key Points
- A subnet mask is a 32-bit companion to an IPv4 address that marks which bits are network and which are host.
- Mask bit = 1 means "network"; mask bit = 0 means "host."
- A valid mask is contiguous: a solid run of 1s followed by a solid run of 0s, so the boundary is a single clean point.
- The count of 1-bits equals the CIDR prefix length, so 255.255.255.0 and /24 mean the same thing.
- 255 appears because it is an octet with all 8 bits set (128+64+32+16+8+4+2+1); an octet of 0 is all host bits.
A subnet mask partners with a 32-bit IPv4 address to answer one question: which bits identify the network, and which identify the individual host? Think of a postal address — "city and street" tells you the neighborhood (the network), while the "house number" identifies the specific building (the host). Wherever the mask has a 1, that address bit belongs to the network portion; wherever it has a 0, that bit belongs to the host portion. So for 192.168.10.50 with mask 255.255.255.0, the first three octets (192.168.10) are the network and the final octet (50) is the host.
Figure 4.1: How the mask splits an address into network and host portions
graph TD
A["Subnet Mask: 255.255.255.0"] --> B["Mask bit = 1
(network side)"]
A --> C["Mask bit = 0
(host side)"]
B --> D["Network portion:
192.168.10"]
C --> E["Host portion:
50"]
D --> F["Identifies WHICH network
(the neighborhood)"]
E --> G["Identifies WHICH host
(the specific building)"]
A valid mask must be contiguous: a solid run of 1-bits followed by a solid run of 0-bits, ones first, then zeros, with no interleaving. Because the 1s all come first, the boundary between network and host is a single point in the 32-bit string — a clean tear rather than a shredded strip. The bits must be contiguous, but they are not required to land on octet boundaries; that freedom is what makes masks like /26 (255.255.255.192) legal.
A mask is written just like an IP address — four dotted-decimal octets — but its meaning is clearest in binary. 255.255.255.0 expands to:
11111111.11111111.11111111.00000000
The 24 leading ones say "the first 24 bits are network"; the 8 trailing zeros say "the last 8 bits are host." That is exactly what CIDR captures as /24 — the prefix length is simply the count of 1-bits in the mask. The value 255 recurs because it is an octet with all eight bits set (128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255); a fully "host" octet reads as 0.
Visual animation — coming soon
An IP address by itself tells you "who" a device is. What crucial piece of information does the subnet mask add?
The MAC (hardware) address of the device
Which bits identify the network versus the individual host
The speed of the physical link
The domain name that maps to the address
In a subnet mask, what does a bit set to 1 signify about the corresponding bit of the IP address?
That bit belongs to the host portion
That bit belongs to the network portion
That bit is always ignored by routers
That bit must be flipped before use
Which of the following is a valid subnet mask, given that masks must be contiguous?
11111111.00000000.11111111.00000000
11111111.11111111.11100000.00000000
10101010.11111111.00000000.00000000
00000000.11111111.11111111.11111111
Why are the mask 255.255.255.0 and the CIDR notation /24 considered two ways of writing the same fact?
Because 255 divided by 24 equals a whole number
Because /24 counts the 24 one-bits in the mask
Because both describe a wildcard mask
Because 24 is the number of usable hosts in the block
Why does the value 255 appear so often in subnet masks?
Because 255 is the largest IP address value allowed
Because 255 is a special reserved routing number
Because 255 is what an octet equals when all 8 of its bits are set to 1
Because 255 marks the broadcast address of every network
Why can you read the network/host split of 255.255.0.0 at a glance, without any binary math?
Because every /16 mask is memorized by routers automatically
Because each octet is either fully 255 (all network) or fully 0 (all host)
Because 255.255.0.0 has no host bits at all
Because the boundary always falls in the third octet
The last octet of a subnet mask shows the value 224. How many network bits are set within that octet?
2 bits
3 bits
4 bits
5 bits
A colleague writes a mask ending in the octet 200 (binary 11001000). Why is this mask invalid?
200 is larger than the maximum allowed octet value
Its bits are not contiguous — there is a 0 between 1s, so it is not a legal octet value
Only 255 and 0 are ever allowed in any mask octet
200 is reserved for wildcard masks only
Converting /26 to dotted decimal gives 255.255.255.192. Where does the 192 come from?
26 minus 8 equals 18, and 18 rounds to 192
Three octets use 24 bits, leaving 2 network bits in the fourth octet: 11000000 = 192
192 is 255 minus the prefix length of 26 plus 37
The fourth octet always equals 192 for any /25 through /30
The wildcard mask is the inverse of the subnet mask. What is the wildcard mask for 255.255.255.0, and how is it found?
0.0.0.255, by subtracting each mask octet from 255
255.255.255.255, by adding 255 to each octet
255.0.0.0, by reversing the octet order
0.0.0.0, because /24 has no don't-care bits
Common Subnet Masks
Key Points
- Octet-aligned masks — 255.0.0.0 (/8), 255.255.0.0 (/16), 255.255.255.0 (/24) — are read at a glance by spotting which octets are 255.
- A mask boundary may fall inside an octet, producing a value other than 0 or 255.
- Within one octet, a mask can only be one of nine legal values: 0, 128, 192, 224, 240, 248, 252, 254, 255 (0 through 8 network bits).
- /26 = 24 bits + 2 more bits (11000000 = 192) = 255.255.255.192.
- A wildcard mask is the bit-for-bit inverse of the subnet mask; compute it by subtracting each octet from 255.
Three masks show up constantly because they fall precisely on octet boundaries:
- 255.0.0.0 (
/8) — 11111111.00000000.00000000.00000000. First octet network; last three host.
- 255.255.0.0 (
/16) — 11111111.11111111.00000000.00000000. First two octets network; last two host.
- 255.255.255.0 (
/24) — 11111111.11111111.11111111.00000000. First three octets network; last octet host — the classic "one office LAN."
Because each octet is either fully 255 or fully 0, you read the split just by looking at which octets are 255 — no binary math needed. But the boundary is allowed to fall inside an octet, and then that octet shows a value other than 0 or 255. As network bits fill from the high (left) end, an octet can only ever take one of nine legal values:
| Bits set (high end) | Binary octet | Decimal value |
| 0 | 00000000 | 0 |
| 1 | 10000000 | 128 |
| 2 | 11000000 | 192 |
| 3 | 11100000 | 224 |
| 4 | 11110000 | 240 |
| 5 | 11111000 | 248 |
| 6 | 11111100 | 252 |
| 7 | 11111110 | 254 |
| 8 | 11111111 | 255 |
These nine values let you translate quickly between a CIDR prefix and a mask. Worked example — /26: 26 network bits = 24 bits (three octets of 255) + 2 more bits in the fourth octet. Two high-end bits give 11000000 = 192, so /26 = 255.255.255.192. The final octet is neither 0 nor 255, yet the mask is perfectly valid.
The reference table below is one of the most-consulted tools in networking. It maps CIDR prefixes to their dotted-decimal mask, the inverse wildcard mask, the total addresses, and the usable hosts.
| CIDR | Subnet Mask | Wildcard Mask | Total Addresses | Usable Hosts |
| /8 | 255.0.0.0 | 0.255.255.255 | 16,777,216 | 16,777,214 |
| /9 | 255.128.0.0 | 0.127.255.255 | 8,388,608 | 8,388,606 |
| /10 | 255.192.0.0 | 0.63.255.255 | 4,194,304 | 4,194,302 |
| /16 | 255.255.0.0 | 0.0.255.255 | 65,536 | 65,534 |
| /20 | 255.255.240.0 | 0.0.15.255 | 4,096 | 4,094 |
| /24 | 255.255.255.0 | 0.0.0.255 | 256 | 254 |
| /25 | 255.255.255.128 | 0.0.0.127 | 128 | 126 |
| /26 | 255.255.255.192 | 0.0.0.63 | 64 | 62 |
| /27 | 255.255.255.224 | 0.0.0.31 | 32 | 30 |
| /28 | 255.255.255.240 | 0.0.0.15 | 16 | 14 |
| /29 | 255.255.255.248 | 0.0.0.7 | 8 | 6 |
| /30 | 255.255.255.252 | 0.0.0.3 | 4 | 2 |
The wildcard mask is the bit-for-bit inverse of the subnet mask, found by subtracting each octet from 255. It looks identical on paper but carries the opposite meaning: in a subnet mask a 1 means "part of the network," while in a wildcard mask a 0 means "must match exactly" and a 1 means "don't care." Wildcard masks put their 0s at the beginning, so a larger CIDR prefix produces a smaller wildcard mask. They appear in Cisco ACLs and OSPF/EIGRP network statements — e.g. access-list 10 permit 192.168.1.0 0.0.0.255 matches all of 192.168.1.0/24. Unlike subnet masks, wildcard masks are not required to be contiguous, letting them match patterns like only odd or only even subnets.
Why can you read the network/host split of 255.255.0.0 at a glance, without any binary math?
Because every /16 mask is memorized by routers automatically
Because each octet is either fully 255 (all network) or fully 0 (all host)
Because 255.255.0.0 has no host bits at all
Because the boundary always falls in the third octet
The last octet of a subnet mask shows the value 224. How many network bits are set within that octet?
2 bits
3 bits
4 bits
5 bits
A colleague writes a mask ending in the octet 200 (binary 11001000). Why is this mask invalid?
200 is larger than the maximum allowed octet value
Its bits are not contiguous — there is a 0 between 1s, so it is not a legal octet value
Only 255 and 0 are ever allowed in any mask octet
200 is reserved for wildcard masks only
Converting /26 to dotted decimal gives 255.255.255.192. Where does the 192 come from?
26 minus 8 equals 18, and 18 rounds to 192
Three octets use 24 bits, leaving 2 network bits in the fourth octet: 11000000 = 192
192 is 255 minus the prefix length of 26 plus 37
The fourth octet always equals 192 for any /25 through /30
The wildcard mask is the inverse of the subnet mask. What is the wildcard mask for 255.255.255.0, and how is it found?
0.0.0.255, by subtracting each mask octet from 255
255.255.255.255, by adding 255 to each octet
255.0.0.0, by reversing the octet order
0.0.0.0, because /24 has no don't-care bits
Which operation is applied between an IP address and its subnet mask to derive the network address?
Bitwise OR
Bitwise AND
Decimal addition
Bitwise XOR
In the AND operation, why do the network bits of the address survive unchanged while the host bits become 0?
AND-ing with 1 preserves a bit, while AND-ing with 0 clears it — and the mask is 1s over the network, 0s over the host
Because the router copies only the first three octets by convention
Because host bits are always physically zero in memory
Because AND randomly rounds host values down to 0
You AND 192.168.10.50 with 255.255.255.0. What network address results?
192.168.10.50
192.168.10.0
192.168.0.0
255.255.255.50
For a /24 network, how many usable hosts are available, and why is it not the full 256?
256, because every address in the block can be assigned
254, because the network address and broadcast address are reserved
255, because only the broadcast address is reserved
128, because half the block is reserved for future growth
A /30 is the classic choice for a point-to-point link between two routers. Why does it fit so well?
Because a /30 provides exactly 2 usable hosts — one for each end of the link
Because a /30 has no host bits, so no addresses are wasted
Because a /30 supports 254 usable hosts for future expansion
Because routers require the broadcast address to be usable
Applying the Mask
Key Points
- Apply a mask with a bitwise AND:
IP AND mask yields the network address.
- AND-ing with 1 preserves a bit; AND-ing with 0 clears it — so network bits survive and host bits zero out.
- The remaining 0-mask bits are the host portion; overlay the mask on the address to read the two zones.
- With n = 32 − prefix host bits, a block holds 2ⁿ total addresses and 2ⁿ − 2 usable hosts.
- The "minus 2" reserves the all-zeros network address and the all-ones broadcast address.
The mask is applied through a bitwise AND: IP address AND subnet mask yields the network address. The AND truth table is 1&1=1, 1&0=0, 0&1=0, 0&0=0. The hidden pattern: AND-ing any bit with 1 preserves it, while AND-ing with 0 clears it to 0. Because the mask has 1s over the network portion and 0s over the host portion, the operation keeps the network bits exactly as they are and zeroes every host bit.
Worked example — 192.168.10.50 with 255.255.255.0:
IP address : 192.168.10.50 = 11000000.10101000.00001010.00110010
Subnet mask: 255.255.255.0 = 11111111.11111111.11111111.00000000
------------------------------ AND ---------------------------------
Network : 192.168.10.0 = 11000000.10101000.00001010.00000000
In the first three octets the mask is all 1s, so 192, 168, and 10 pass through unchanged. In the fourth octet the mask is all 0s, so the host value 50 (00110010) is cleared to 0 — giving the network address 192.168.10.0. This is exactly how a router decides local vs. remote: every host that produces the same AND result is on the same subnet.
Figure 4.2: The bitwise AND process for deriving a network address
flowchart TD
A["IP address
192.168.10.50"] --> C{"Bitwise AND
bit by bit"}
B["Subnet mask
255.255.255.0"] --> C
C --> D["Mask bit = 1
preserve the address bit"]
C --> E["Mask bit = 0
clear the address bit to 0"]
D --> F["Network bits kept:
192.168.10"]
E --> G["Host bits zeroed:
.0"]
F --> H["Network address
192.168.10.0"]
G --> H
The leftover bits — everything the mask marked with a 0 — are the host portion. Overlaying the mask on the address makes the split obvious:
Address : 192 . 168 . 10 . 50
Mask : 255 . 255 . 255 . 0
Role : NET NET NET HOST
For non-octet-aligned masks the same overlay works at the bit level — the boundary just lands partway through an octet, splitting one octet into some network and some host bits.
The mask also dictates how many hosts a network can hold. Let n be the number of host bits, where n = 32 − prefix. Then total addresses = 2ⁿ and usable hosts = 2ⁿ − 2. The "minus 2" reserves the all-zeros host address (the network address) and the all-ones host address (the broadcast address).
Figure 4.3: Deriving host capacity from the prefix
flowchart LR
A["Prefix length
e.g. /24"] --> B["Host bits
n = 32 − prefix"]
B --> C["Total addresses
2^n"]
C --> D["Subtract 2:
network + broadcast"]
D --> E["Usable hosts
2^n − 2"]
Worked example — a /24: n = 32 − 24 = 8 host bits, so 2⁸ = 256 total and 256 − 2 = 254 usable — matching the reference table. The point-to-point case — a /30: n = 32 − 30 = 2 host bits, so 2² = 4 total and only 4 − 2 = 2 usable, exactly what a router-to-router link needs (one address per end). The design lesson: the more network bits you commit, the fewer host bits remain, so choosing a mask is always a trade-off between number of subnets and hosts per subnet — the tension that VLSM later resolves.
Visual animation — coming soon
Which operation is applied between an IP address and its subnet mask to derive the network address?
Bitwise OR
Bitwise AND
Decimal addition
Bitwise XOR
In the AND operation, why do the network bits of the address survive unchanged while the host bits become 0?
AND-ing with 1 preserves a bit, while AND-ing with 0 clears it — and the mask is 1s over the network, 0s over the host
Because the router copies only the first three octets by convention
Because host bits are always physically zero in memory
Because AND randomly rounds host values down to 0
You AND 192.168.10.50 with 255.255.255.0. What network address results?
192.168.10.50
192.168.10.0
192.168.0.0
255.255.255.50
For a /24 network, how many usable hosts are available, and why is it not the full 256?
256, because every address in the block can be assigned
254, because the network address and broadcast address are reserved
255, because only the broadcast address is reserved
128, because half the block is reserved for future growth
A /30 is the classic choice for a point-to-point link between two routers. Why does it fit so well?
Because a /30 provides exactly 2 usable hosts — one for each end of the link
Because a /30 has no host bits, so no addresses are wasted
Because a /30 supports 254 usable hosts for future expansion
Because routers require the broadcast address to be usable