Activity 1.2.2

The Binary Number System

BinaryNumber SystemsConversion

Learn why computers use the binary (base-2) number system, how to convert between binary and decimal, and the importance of standard bit groupings like bytes and nibbles.

0 of 0

We use the decimal (base-10) number system every day without thinking about it. However, electronic devices operate on the binary (base-2) number system.

Our Familiar Decimal System

Decimal is built on ten unique digits (0-9) and place values that increase by powers of 10. For example, in the number 4,739:

Place values:    1000      100       10        1
               (103)     (102)     (101)     (100)
                 -----     -----     ----      ---
Digits:              4         7        3        9

Calculation:  (4 × 1000) + (7 × 100) + (3 × 10) + (9 × 1)
            =  4000 + 700 + 30 + 9
            =  4,739

Why Do Computers Use Binary?

Computers do not use base-10 because representing ten separate voltage states is electronically difficult and highly prone to signal noise. Instead, they use base-2 because:

  • Two physical states: A transistor switch is naturally either ON (conducting electricity) or OFF (not conducting).
  • High reliability: It is simple for hardware to distinguish between a clear "high voltage" (e.g. 5V = 1) and "low voltage" (e.g. 0V = 0).
  • Noise resistance: Slight voltage fluctuations (e.g., a drop to 4.7V) do not trigger logical errors, unlike decimal where a small shift could change a 7 into a 6.

Why is binary more noise-resistant than decimal in digital systems?

Binary only needs to distinguish between two widely separated voltage levels (HIGH and LOW). A small amount of noise or interference will not change the logical state of a switch. In a decimal electronic system, the voltage thresholds would have to be divided into ten small increments, making the logic highly vulnerable to errors from tiny noise spikes.

Because binary is a base-2 system, place values increase by powers of 2 (1, 2, 4, 8, 16...) from right to left, rather than powers of 10.

8-Bit Place Value Map

In standard 8-bit registers (one byte), each coordinate column represents an exponent of 2. We read the columns from right (Least Significant Bit or LSB) to left (Most Significant Bit or MSB):

Bit Position 7 (MSB) 6 5 4 3 2 1 0 (LSB)
Exponential Value 27 26 25 24 23 22 21 20
Decimal Place Weight 128 64 32 16 8 4 2 1

Interactive Register Simulator

Explore binary place values below. Notice how the visual weight of each bit increases exponentially as you move from Bit 0 (1) to Bit 7 (128). Test yourself using the challenges!

🎛️ 8-Bit Binary Register

Toggle the switches to change the register contents.

Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Binary Representation0000 | 0000(MSB) Nibble 1 | Nibble 2 (LSB)
Decimal Value0No active place values
ASCII CharacterCTRLNUL (Null character)
🏆 Binary ChallengeChallenge 1 of 6

Represent the decimal number 100.

Current state: 0 (Target: 100)

What is the place weight of Bit 6 in a standard binary register?

The place weight of Bit 6 is 64 (calculated as 26). Remember that positions are 0-indexed starting from the rightmost bit: Bit 0 = 1, Bit 1 = 2, Bit 2 = 4, Bit 3 = 8, Bit 4 = 16, Bit 5 = 32, Bit 6 = 64, Bit 7 = 128.

Counting in binary follows the same rules as decimal: when a column runs out of digits, you reset it to 0 and carry 1 to the left.

Binary Counting Sequence (0-15)

Study how binary values increment. Observe how we run out of column space and add bits dynamically:

Decimal Binary Decimal Binary
0000081000
1000191001
20010101010
30011111011
40100121100
50101131101
60110141110
70111151111

Key Patterns to Observe:

  • The Least Significant Bit (Bit 0): Toggles back and forth between 0 and 1 on every single count (0 → 1 → 0 → 1).
  • Bit 1: Toggles every 2 counts (00 → 01 → 10 → 11).
  • Bit 2: Toggles every 4 counts.
  • Bit 3: Toggles every 8 counts.
  • Carrying over: When you add 1 to a column containing 1, it resets to 0 and propagates a carry leftward (e.g. 0111 + 1 = 1000).

What is the binary representation of decimal 16? (Hint: Think about what happens when you increment 15/1111)

The binary representation of 16 is 10000. Incrementing 15 (11112) by 1 causes all four columns to carry over, cascading to the next column on the left (24 = 16).

Converting binary to decimal uses the weighted sum method. You multiply each binary digit by its column place weight and add the non-zero terms together.

Weighted Sum Conversion Method

  1. Write the binary number down.
  2. List the place values (1, 2, 4, 8, 16...) above each digit from right to left.
  3. Identify every column that contains a 1.
  4. Sum the place values of those columns to find the decimal total.
Worked Example 1

Convert 110102 to Decimal:

Place weights:  16   8   4   2   1
Binary value:   1   1   0   1   0

Calculation:
(1 × 16) + (1 × 8) + (0 × 4) + (1 × 2) + (0 × 1)
= 16 + 8 + 0 + 2 + 0
= 26

Answer: 110102 = 2610
Worked Example 2

Convert 1011012 to Decimal:

Place weights:  32  16   8   4   2   1
Binary value:   1   0   1   1   0   1

Calculation:
(1 × 32) + (0 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (1 × 1)
= 32 + 0 + 8 + 4 + 0 + 1
= 45

Answer: 1011012 = 4510

Convert 10001011₂ to decimal.

The decimal value is 139.
Place weights: 128 (1), 64 (0), 32 (0), 16 (0), 8 (1), 4 (0), 2 (1), 1 (1).
Calculation: 128 + 8 + 2 + 1 = 139.

Converting decimal to binary uses the successive division method. You divide the number by 2 repeatedly and read the remainders backward.

Successive Division by 2 Method

  1. Divide the decimal number by 2.
  2. Write down the whole quotient and note the remainder (either 0 or 1).
  3. Divide the new quotient by 2. Record the remainder.
  4. Repeat until the quotient is 0.
  5. Read the remainders from bottom to top (or right to left) to get the binary value.
Worked Example: Convert 45 to Binary
Calculation steps:
45 ÷ 2 = 22  remainder 1   ↑ LSB
22 ÷ 2 = 11  remainder 0   ↑
11 ÷ 2 =  5  remainder 1   ↑
 5 ÷ 2 =  2  remainder 1   ↑
 2 ÷ 2 =  1  remainder 0   ↑
 1 ÷ 2 =  0  remainder 1   ↑ MSB

Read remainders bottom to top: 101101

Answer: 4510 = 1011012
Alternative subtraction method: Find the largest power of 2 that fits inside your target number, subtract it, and repeat with the remainder.

Example (45):
45 - 32 = 13 (place 32 = 1)
13 - 8 = 5 (place 8 = 1, place 16 = 0)
5 - 4 = 1 (place 4 = 1)
1 - 1 = 0 (place 1 = 1, place 2 = 0)
Resulting code: 1011012
Key Insight (Value 127): The largest value representable by a signed 8-bit integer is 127 (011111112). This value marks critical boundaries in internet networking, ASCII data ranges, and memory buffer allocations.

Convert 155₁₀ to binary.

The binary value is 10011011.
Subtraction check:
155 - 128 = 27 (128 weight is 1)
27 - 16 = 11 (64 and 32 are 0, 16 is 1)
11 - 8 = 3 (8 is 1)
3 - 2 = 1 (4 is 0, 2 is 1)
1 - 1 = 0 (1 is 1)
Result = 100110112.

Single bits are rarely handled alone. Computer architectures combine bits into standardized sizes like nibbles and bytes to manage memory and character codes.

Bit Groupings Table

Unit Bit Count Decimal Value Range Purpose / Usage
Bit 1 0 to 1 (2 values) Single logic state (true/false, on/off)
Nibble 4 0 to 15 (16 values) Half a byte, represents a single Hexadecimal digit
Byte 8 0 to 255 (256 values) Fundamental block of computer storage; holds one ASCII character
Word 16, 32, 64 Varies by system Natural data size handled by a processor's register

ASCII Character Codes

A byte can represent text letters, numbers, and symbols. The ASCII standard maps characters to specific binary values. For example:

  • The capital letter 'A' is decimal 65 (binary 01000001).
  • The lowercase letter 'a' is decimal 97 (binary 01100001).
  • The symbol '!' is decimal 33 (binary 00100001).

Practice Problems

Solve these practice problems to gain fluency. Click "Show Answer" to reveal the full calculation steps.

Practice Problem 1: Convert 10011011₂ to decimal.

Step 1: Write place values

128    64    32    16     8     4     2     1
----  ----  ----  ----  ----  ----  ----  ----
  1     0     0     1     1     0     1     1

Step 2: Multiply and sum

(1×128) + (0×64) + (0×32) + (1×16) + (1×8) + (0×4) + (1×2) + (1×1)
= 128 + 16 + 8 + 2 + 1
= 155

Answer: 100110112 = 15510

Practice Problem 2: Convert 217₁₀ to binary.

Step 1: Successive division by 2

217 ÷ 2 = 108  remainder 1
108 ÷ 2 =  54  remainder 0
 54 ÷ 2 =  27  remainder 0
 27 ÷ 2 =  13  remainder 1
 13 ÷ 2 =   6  remainder 1
  6 ÷ 2 =   3  remainder 0
  3 ÷ 2 =   1  remainder 1
  1 ÷ 2 =   0  remainder 1

Step 2: Read remainders from bottom to top

Result = 11011001

Check: 128 + 64 + 16 + 8 + 1 = 217 ✓

Practice Problem 3: What is the maximum decimal value that can be represented with 4 bits? Show your work.

With 4 bits, the maximum binary value is 11112.

Place weights: 8, 4, 2, 1

Calculation: 8 + 4 + 2 + 1 = 15

Answer: The maximum value is 15. This allows for 16 possible unique combinations (0 through 15).

Interactive Self-Check Quiz

Complete the multiple-choice checks below. Correct answers are required to unlock completed section progress indicators.

Quick Check 1: What is 45 in binary?

Quick Check 2: Convert the binary number 11010 to decimal:

Quick Check 3: A group of 8 bits is called a: