2.1.1 Binary representation of data

Why Binary?

All data inside a computer — numbers, text, images, sound, video, program instructions — is stored and processed as binary: sequences of the digits 0 and 1. This is because computers are built from electronic circuits that have only two stable states: on or off (high voltage or low voltage). A single on/off state represents one bit (binary digit).

Binary is a base-2 number system. Unlike denary (base 10), which uses ten digits (0–9), binary uses only two digits: 0 and 1. Every value stored in a computer must ultimately be encoded as a combination of these two symbols.

Why not use more states?

Electronic circuits can reliably distinguish two voltage levels (on/off). Using more levels (e.g. low/medium/high) would require more precise electronics, making circuits more expensive, slower and prone to errors due to electrical interference. Binary's simplicity makes it extremely robust.

Bits and Bytes

TermSizeNotes
Bit1 binary digit (0 or 1)The smallest unit of data
Nibble4 bitsHalf a byte; one hexadecimal digit
Byte8 bitsThe standard unit for storing one character

With n bits, it is possible to represent 2ⁿ different values. For example:

  • 1 bit → 2 values (0 or 1)
  • 4 bits → 2⁴ = 16 values (0000 to 1111)
  • 8 bits → 2⁸ = 256 values (00000000 to 11111111)

Everything Is Binary

The same physical bits are used to store all types of data. What distinguishes them is how the bit pattern is interpreted:

Data typeHow it is encoded in binary
IntegersPositional binary (unsigned or two's complement)
TextCharacter encoding (ASCII or Unicode)
ImagesPixel colour values (bit depth per pixel)
SoundSampled amplitude values (sample rate and bit depth)
InstructionsMachine code operation codes and operands

The bit pattern 01000001 could mean the integer 65, the character 'A' (ASCII), or a specific instruction to the processor — the interpretation depends on context.

 Key Takeaways

  • All data is stored as binary (0s and 1s) because electronic circuits have two stable states.
  • A bit is one binary digit; a byte is 8 bits.
  • n bits can represent 2ⁿ different values.
  • The same bit pattern can represent different data types depending on how it is interpreted.