Skip to content
uencoder

Binary

Binary is the base-2 numeral system, using only 0 and 1, and is the foundation of internal data representation in all digital electronic computers.

Purpose

It maps directly onto the two voltage levels of digital circuits (high/low), letting hardware implement arithmetic and storage with simple logic gates.

Mechanism

Each binary digit is one bit, expanded by powers of 2^n. A byte is 8 bits. Negative numbers use two's complement, and fractions use floating-point formats (IEEE 754).

Use cases

  • Low-level bit operations and masking
  • Bitmap and Bloom filter storage
  • Bit-field parsing in network protocols
  • Teaching and algorithm visualization

Examples

  • Input
    42
    Output
    00101010

    42 = 32 + 8 + 2

Common errors

Mixing up signed and unsigned interpretation
Make the type and interpretation context explicit

Related terms

Related tools

References