2.1 Binary & Decimal Conversion

Key Takeaways

  • Binary is base-2: each bit position is a power of 2 (1, 2, 4, 8, 16, 32, 64, 128 for an 8-bit byte)
  • Binary-to-decimal: sum the place values of bits that are 1; decimal-to-binary: repeatedly subtract the largest power of 2 that fits
  • An IPv4 address is four decimal octets (0–255); each octet is exactly 8 bits — conversion skill transfers directly to subnetting
  • Under time pressure, memorize powers of 2 through at least 2^10 (1024) and use nibble grouping (4 bits) as a speed check
  • Common exam traps: leading zeros do not change value; MSB is the leftmost bit; 11111111₂ = 255₁₀ for unsigned 8-bit
Last updated: July 2026

Computers store and process everything as bits — values that are either 0 or 1. Humans prefer decimal (base-10). The Cyber Test expects you to move between these representations accurately and quickly, because binary underpins networking (IPv4 octets), permissions masks, crypto bit patterns, and low-level debugging. This section builds the conversion habits you need under time pressure.

Why Binary Matters for Cyber

Every digital value — an IP address byte, a file permission flag, a cryptographic key bit — is ultimately a pattern of bits. If you cannot read those patterns, later topics (subnetting, bitwise ACL logic, hash digests) feel like memorization instead of reasoning. Binary fluency is a multiplier for the rest of Computing Fundamentals and Networking on the Cyber Test (CT / CSAT).

Place Value: The Core Idea

In decimal, the number 347 means 3 × 100, plus 4 × 10, plus 7 × 1. Binary works the same way, but the base is 2. Each column is a power of 2, doubling as you move left from the least significant bit (LSB) on the right to the most significant bit (MSB) on the left.

Bit position (from right)PowerDecimal value
0 (LSB)2⁰1
12
24
38
42⁴16
52⁵32
62⁶64
7 (MSB in a byte)2⁷128
82⁸256
92⁹512
102¹⁰1024

Memorize at least through 2¹⁰. On exam day you will not have time to rebuild the table from scratch for every question. Knowing that 2⁷ = 128 and 2⁸ = 256 also prevents the most common off-by-one power error near the top of an octet.


Binary to Decimal

Method: Write the bit string. Align each bit under its place value. Add the place values where the bit is 1; ignore positions that are 0.

Worked Example 1: 10110101₂

Align an 8-bit byte:

1286432168421
10110101

Sum the 1s: 128 + 32 + 16 + 4 + 1 = 181₁₀.

Worked Example 2: 11111111₂

All bits set: 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255₁₀. That is the maximum unsigned value of one IPv4 octet — a fact you will reuse constantly in subnetting and mask questions.

Worked Example 3: Shorter strings

1101₂ → 8 + 4 + 1 = 13₁₀. Leading zeros (00001101₂) do not change the value; they only pad to a fixed width (byte or word). The exam may show either form.


Decimal to Binary

Method (subtractive / greedy): Starting from the largest power of 2 that does not exceed the number, place a 1 if that power fits; otherwise place a 0. Subtract when you place a 1. Continue down to 2⁰.

Worked Example 4: Convert 200₁₀ to 8-bit binary

  1. 128 fits → bit7 = 1; remainder 72
  2. 64 fits → bit6 = 1; remainder 8
  3. 32 does not → bit5 = 0
  4. 16 does not → bit4 = 0
  5. 8 fits → bit3 = 1; remainder 0
  6. 4, 2, 1 → all 0

Result: 11001000₂. Check: 128 + 64 + 8 = 200. Always reverse-check when time allows — one arithmetic slip flips an answer choice.

Worked Example 5: Convert 45₁₀

32 fits (remainder 13); 16 does not; 8 fits (remainder 5); 4 fits (remainder 1); 2 does not; 1 fits → 101101₂ (or 00101101 as a padded byte).

Worked Example 6: Convert 156₁₀

128 fits (remainder 28); 64 no; 32 no; 16 fits (remainder 12); 8 fits (remainder 4); 4 fits (remainder 0) → 10011100₂. Check: 128 + 16 + 8 + 4 = 156.


Speed Techniques Under Time Pressure

  1. Powers table first. Before a conversion block, jot 1, 2, 4, 8, 16, 32, 64, 128 once on scratch paper.
  2. Nibble split. Group bits in fours from the right (1101 0101). Each nibble is 0–15 decimal — useful later for hex, and a sanity check that you did not drop a bit.
  3. Know landmark values. Half a byte max unsigned = 255; 128 is the high bit of an octet; 2¹⁰ = 1024 is the classic "1K" landmark in memory sizes.
  4. Eliminate impossible options. An 8-bit unsigned value cannot exceed 255. A string with only three 1-bits cannot sum past the three largest candidates you assign — use magnitude to discard distractors quickly.

Tie-In: IPv4 Octets and Crypto Bit Patterns

An IPv4 address such as 192.168.1.10 is four decimal numbers, each representing 8 bits (an octet). Converting 192: 128 + 64 = 192 → 11000000₂. Converting 168: 128 + 32 + 8 = 168 → 10101000₂. When you later learn subnet masks (255.255.255.0 = /24), you are really counting contiguous 1-bits. Binary↔decimal conversion is the bridge from dotted-decimal notation to bit-level network logic.

Cryptography and integrity tooling also speak in bit patterns: flipping a single bit in a key, IV, or MAC invalidates the value. Recognizing that eight 1-bits equal decimal 255 (or "all bits set" in a byte) starts here and carries into bitmask and encoding questions.


Exam Traps

  • MSB vs LSB: The leftmost bit in the written string is the most significant (highest place value). Do not reverse the string when summing.
  • Width confusion: 1111₂ is 15, not 255. Padding to 8 bits (00001111) keeps the value 15.
  • Off-by-one powers: Mixing up 2⁷ = 128 with 2⁸ = 256 is a classic error when converting values near 200–255.
  • "Binary looks like decimal": The digits 10 in binary equal two, not ten. Always interpret by base.
  • Unsigned assumption: Until two's complement is in play, treat conversion questions as non-negative unless the stem says signed.

Quick Reference Checklist

  • Powers of 2 through 1024 memorized
  • Binary→decimal = sum of place values for 1-bits
  • Decimal→binary = greedy subtract of powers of 2
  • IPv4 octet range = 0–255 = 8 bits
  • Reverse-check every conversion when stakes are high

Drill until conversion is automatic: pick random decimals 0–255 and produce 8-bit binary; pick random 8-bit strings and sum to decimal. Aim for under 20 seconds per item so later networking and bitwise questions do not stall on arithmetic.

Test Your Knowledge

What is the decimal value of the binary number 11001001?

A
B
C
D
Test Your Knowledge

Convert the decimal number 156 to 8-bit binary.

A
B
C
D
Test Your Knowledge

Which statement about an IPv4 octet is correct?

A
B
C
D
Test Your Knowledge

What is the binary representation of decimal 45 as a 6-bit string (no unnecessary leading zeros beyond that width)?

A
B
C
D