Objective. Students will convert values among binary, decimal, and hexadecimal number systems and perform binary AND operations needed for IPv4 subnet mask calculations, without a calculator, at the accuracy level required on CompTIA and Cisco certification exams.
This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
Every certification exam you will sit — CompTIA A+, Network+, Cisco CCST, and CCNA — tests your ability to work with binary, decimal, and hexadecimal numbers without a calculator. Subnetting questions alone can account for a significant portion of your networking exam score. Mastering these conversions by hand is not optional; it is a core trade skill.
Decimal (Base 10) is the everyday system. It uses digits 0–9. Each position is a power of 10: ones, tens, hundreds, and so on.
Binary (Base 2) is the native language of digital hardware. It uses only two digits: 0 and 1. Each position is a power of 2. An 8-bit binary number (one octet) uses these place values from left to right:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|-----|----|----|----|---|---|---|---|
Memorise those eight values — they are the foundation of every subnetting calculation you will ever do.
Hexadecimal (Base 16) uses digits 0–9 and letters A–F, where A = 10, B = 11, C = 12, D = 13, E = 14, F = 15. Hex is used for MAC addresses, IPv6 addresses, color codes, and memory addressing. One hex digit represents exactly four binary bits (a nibble), which makes conversion between hex and binary straightforward.
Use the subtraction (greedy) method:
1. Write out the eight place values: 128, 64, 32, 16, 8, 4, 2, 1.
2. Starting at 128, ask: "Does this value fit into my number?" If yes, write a 1 and subtract. If no, write a 0 and move right.
3. Continue until all eight positions are filled.
Practice until you can convert any decimal value between 0 and 255 in under 15 seconds. That speed is realistic and exam-necessary.
Add up the place values wherever a 1 appears. For example, if bits 7, 5, 3, and 0 are set (counting from the left), you add 128 + 32 + 8 + 1.
Hex to decimal: Multiply the left digit by 16, add the right digit's value.
Decimal to hex: Divide by 16; the quotient is the left digit, the remainder is the right digit. If either result is 10–15, substitute the letter (A–F).
Hex to binary: Replace each hex digit with its 4-bit binary equivalent directly. No arithmetic needed.
Binary to hex: Group bits into sets of four from the right, then convert each group.
An IPv4 address is 32 bits written as four decimal octets separated by dots (e.g., 192.168.10.50). A subnet mask is also 32 bits; it marks which portion of an address identifies the network versus the host. CIDR notation writes the mask as a prefix length — the number of consecutive 1 bits from the left.
Common prefix lengths and their last-octet masks:
| CIDR | Last-Octet Mask | Host Bits | Usable Hosts |
|------|-----------------|-----------|--------------|
| /24 | 255 | 8 | 254 |
| /25 | 128 | 7 | 126 |
| /26 | 192 | 6 | 62 |
| /27 | 224 | 5 | 30 |
| /28 | 240 | 4 | 14 |
| /29 | 248 | 3 | 6 |
| /30 | 252 | 2 | 2 |
Usable hosts = 2^(host bits) − 2 (subtract the network address and broadcast address).
A bitwise AND compares two bits at a time: the result is 1 only when both input bits are 1; otherwise the result is 0.
| A | B | A AND B |
|---|---|---------|
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 0 |
To find the network address, perform a binary AND between the host IP address and the subnet mask, bit by bit across all 32 bits.
The broadcast address is found by setting all host bits to 1 while keeping the network bits unchanged.
The usable host range is every address between the network address and the broadcast address, exclusive.
Although this lesson is mathematical, it connects directly to safe and responsible network administration. Miscalculating a subnet mask in a production environment can isolate devices, create routing loops, or break security boundaries — outcomes that may affect safety systems, medical equipment networks, or industrial controls. Always verify subnet calculations with a second method (or a subnet calculator) before implementing changes. Document every change and follow your organization's change-control procedures. Good arithmetic is a form of professional safety.
On CompTIA and Cisco exams, subnetting questions have time pressure. Build speed by drilling the eight place values daily until they are automatic. When a subnet question appears, convert each relevant octet to binary, line them up in columns on your scratch paper, AND them together, then read back the result. A systematic column approach on graph paper minimizes errors under pressure.
Answer each question, then check it. Nothing is recorded; this is your own practice.
A free tech program — complimentary, as our commitment to get America working. Help us build VoTechWorks. Tell us what works, what doesn’t, and what you want to learn.