Back to course

Binary Review for Networking

Networking Fundamentals: The 0 to Hero Guide

Lesson 34: Binary Review for Networking

Networking, especially IP addressing and subnetting, is based entirely on binary mathematics. You must be comfortable with converting between decimal and binary.

The Power of Two

Binary uses only two digits (0 and 1). In an 8-bit octet, each position has a specific weighted value, which is a power of 2:

Position1286432168421Total = 255
Value2^72^62^52^42^32^22^12^0

Converting Decimal to Binary

To convert a decimal number (like 172) to binary, find the largest weight that fits, subtract it, and repeat.

Example: Convert 172 to Binary

  1. Is 172 >= 128? Yes (1). Remaining: 172 - 128 = 44.
  2. Is 44 >= 64? No (0).
  3. Is 44 >= 32? Yes (1). Remaining: 44 - 32 = 12.
  4. Is 12 >= 16? No (0).
  5. Is 12 >= 8? Yes (1). Remaining: 12 - 8 = 4.
  6. Is 4 >= 4? Yes (1). Remaining: 4 - 4 = 0.
  7. Is 0 >= 2? No (0).
  8. Is 0 >= 1? No (0).

Result: 10101100

Converting Binary to Decimal

Multiply each binary digit by its weighted position value and sum the results.

Example: Convert 11000000 to Decimal

(1 * 128) + (1 * 64) + (0 * 32) + (0 * 16) + (0 * 8) + (0 * 4) + (0 * 2) + (0 * 1) = 128 + 64 = 192

Practice: Before attempting subnetting, ensure you can quickly convert any decimal number from 0-255 into 8-bit binary.