AP Computer Science Principles — 2.1 Binary Numbers

Unit 2 • Data & Representations

Computers store and process all information using binary—a number system that has only two digits: 0 and 1. These digits are called bits (binary digits). One bit represents two possibilities, but combining many bits allows representation of very large ranges of values and many types of data.

Why Binary?

Digital circuits are designed around two reliable states:

  • Electricity flowing → represented as 1
  • Electricity not flowing → represented as 0

Using two states is efficient and resistant to noise, which is why binary is the foundation of computing.

Positional Number System (Base-2)

Binary is a positional system like decimal. Each position is a power of 2:

Place2⁰
Value8421

Example: 1101₂ = (1×8) + (1×4) + (0×2) + (1×1) = 13₁₀.

Binary Encodes More Than Numbers

Binary is a universal internal representation:

Data TypeHow Binary Is Used
NumbersIntegers and real numbers (e.g., floating point)
TextCharacter codes like ASCII and Unicode
ImagesPixel color values (e.g., RGB channels)
SoundSampled amplitudes over time

Key idea: Regardless of what you see (text, photos, audio), the underlying storage and processing is bits.

Key Terms

TermMeaning
BitA single 0 or 1
Byte8 bits
Base-2The numbering system of binary
Base-10Decimal (everyday human system)
OverflowWhen a value is too large for the allotted bits

Overflow Example

With only 4 bits, the largest value is 1111₂ = 15₁₀.

Trying to store 16 (which is 10000₂) requires 5 bits—so in 4 bits this causes overflow.

Big Idea Takeaway

Binary is the fundamental way computers encode any type of information because hardware naturally supports two stable states. Understanding bits, place value, and overflow prepares you to reason about data, storage, and limits in computing systems.