Binary and hex conversion drill

Updated October 9, 2026

Fast binary conversion is the base skill under subnetting and IPv6. This drill covers 8-bit decimal and binary, two-digit hexadecimal, and the mask octets 128 to 255.

The method

  • Binary place values for one octet, left to right: 128, 64, 32, 16, 8, 4, 2, 1. Add the values that have a 1.
  • Hexadecimal digit = 4 bits. A two-digit hex number is high digit × 16 + low digit; for example C0 is 12 × 16 + 0 = 192.
  • Mask octets only come in eight forms: 128, 192, 224, 240, 248, 252, 254, 255, adding one leading 1-bit at a time.

Converting decimal to binary step by step

The subtraction method never fails. Start at 128 and work right. If the place value fits into what is left, write 1 and subtract it; otherwise write 0.

Worked example: 200 to binary. 128 fits, leaving 72, so the first bit is 1. 64 fits, leaving 8, so the next bit is 1. 32 and 16 do not fit, so 0 and 0. 8 fits, leaving 0, so 1, and the last three bits are 0. The result is 11001000. Check by adding the place values with a 1: 128 + 64 + 8 = 200.

Worked example: 173 to binary. 128 fits (45 left), 64 does not, 32 fits (13 left), 16 does not, 8 fits (5 left), 4 fits (1 left), 2 does not, 1 fits. That gives 10101101, and 128 + 32 + 8 + 4 + 1 = 173.

Going the other way is only addition. 01101100 has ones at 64, 32, 8 and 4, so it equals 108.

Hexadecimal in two steps

Each hexadecimal digit stands for exactly four bits, with A to F meaning 10 to 15. To convert an octet, split it into two halves of four bits and convert each half on its own.

Worked example. 200 is 1100 1000. The first half 1100 is 12, which is C. The second half 1000 is 8. So 200 is C8, and the arithmetic check agrees: 12 × 16 + 8 = 200. In the other direction, 3F is 3 × 16 + 15 = 63. The drill accepts one or two hex digits in either case, so A and 0A both count for 10.

Hexadecimal matters beyond tidy arithmetic. An IPv6 group such as FE80 is 16 bits: FE is 254 and 80 is 128, so the group is 1111 1110 1000 0000. The same skill lets you read a MAC address and see how EUI-64 flips one bit in its first byte.

Mask octets

A subnet mask is a run of ones followed by a run of zeros, so a single octet can only be one of eight values. Each is 256 minus a power of two, which is why the block size in subnetting is the same number:

Mask octetBinaryOne-bitsBlock size
128100000001128
19211000000264
22411100000332
24011110000416
2481111100058
2521111110064
2541111111072
2551111111181

The two mask modes in the drill test exactly this table: from the bit pattern to the decimal value, and from the decimal value to the number of ones. Aim to answer both without working, because the same table sits inside every subnetting question.

How to use the drill

Choose one question type, such as decimal to binary, and stay on it until your streak passes ten. Then switch to mixed mode. After a wrong answer, read the working before you move on, because it shows which place value you missed. The binary mode accepts leading zeros as optional, so 1101 and 00001101 both count for 13.

Common mistakes

  • Reading the place values from the right instead of the left, which turns 128 into 1.
  • Dropping a bit when you write the answer, so the result has seven digits. An octet always has eight.
  • Converting a hex digit as if it were a decimal digit: 1F is 31, not 1 followed by 15.
  • Forgetting that a valid mask never has a zero followed by a one, so 255.0.255.0 is not a mask.

Use the results in subnetting step by step and in the subnetting trainer. Binary is tested in CCNA 200-301 and Network+ N10-009.