EMZETT.
Login

Bits

In short: The smallest unit of information in digital technology — a bit can take on exactly one of two states (0 or 1).

In more detail: All digital data — text, images, programs — is ultimately represented as sequences of bits. Eight bits make a byte. Transmission speeds are usually given in bits per second (e.g. Mbit/s), while file sizes are usually given in bytes (e.g. MB) — a frequent source of confusion.

In Depth

Why binary?

The name “bit” is short for “binary digit” — it describes the fact that digital systems internally only know two distinguishable states: current flows or doesn’t flow, a voltage is above or below a threshold, a magnetic region is aligned in one direction or the other, a capacitor is charged or discharged. This simplicity makes digital circuits extremely robust against interference: a slightly noisy signal can still be unambiguously interpreted as “0” or “1”, as long as the interference doesn’t cross the threshold — unlike analogue systems, where even the smallest deviation immediately becomes part of the signal and gets amplified further with every transmission/copy (which is why, for example, analogue cassette copies sounded audibly worse with every generation, while digital copies stay lossless).

Combinatorics: from bit to byte

By combining individual bits, arbitrarily complex information can be represented: one bit distinguishes 2 states, two bits already 4 (00, 01, 10, 11), eight bits (a byte) already 256, 16 bits already 65,536. This doubling per additional bit is the reason why storage sizes and value ranges in digital technology consistently grow in powers of two (1, 2, 4, 8, 16, 32, 64 GB, etc.) instead of round decimal numbers.

Bits in practice

In practice, bits are mainly encountered in two places: transmission speeds (Mbit/s, Gbit/s for internet connections and network cards — deliberately given in bits rather than bytes, since that produces bigger numbers and thus seemingly more impressive marketing figures) and data types in programming languages such as byte (8 bits), short (16 bits) or long (64 bits), which each define how many bits are reserved for a value — and thereby also what value range can be represented at most. An 8-bit value, for example, can take on at most 256 different states (usually 0-255, or -128 to 127 for signed values), a 32-bit value already over 4 billion.

Bit depth in colours and audio

The concept also appears outside pure computer science: the “colour depth” of a screen or image (e.g. 8-bit or 10-bit per colour channel) determines how many different colour gradations can be shown — 8-bit allows 256 gradations per channel (red, green, blue), 10-bit already 1,024, which makes a visible difference especially with smooth colour gradients (e.g. sky in photos) and reduces “banding” (visible colour steps instead of smooth transitions).

Bitwise operations

In programming, bits can be manipulated individually via “bitwise operators” (e.g. AND, OR, XOR, bit shifting), which operate directly on the binary representation of a number instead of its “ordinary” numeric value. A left bit shift by one position corresponds to a multiplication by 2, a right shift to an (integer) division by 2 — such operations are extremely fast at the CPU level, since they’re implemented directly in hardware as a single computation step, without needing the more elaborate general multiplication/division logic. In practice, bitwise operations are frequently used in low-level optimisations, encryption algorithms, network protocols (e.g. when splitting an IP address into its parts via a subnet mask) or graphics programming, where every saved CPU cycle counts.

Character encoding as a bit application

Text, too, is ultimately represented as sequences of bits: in classic ASCII encoding, 7 bits are enough to uniquely encode 128 different characters (the Latin alphabet, digits, punctuation), while modern systems today almost exclusively use Unicode (usually encoded as UTF-8), which, through a variable number of bytes per character, can also represent characters from practically all the world’s languages as well as emoji. The fact that a simple “a” needs only one byte in ASCII, while a Chinese character needs up to four bytes in UTF-8, illustrates how the basic idea “everything is ultimately a sequence of bits” represents even seemingly completely different data types like text in a unified way.

See also: Bytes, Bit depth