The binary number system uses only two digits—0 and 1—to represent data, making it fundamental to digital computing and electronic systems.
Introduction to binary
The binary number system is a numerical system that uses only two symbols: 0 and 1. It is known as a base-2 system because each digit represents a power of 2. In contrast, the decimal system we use every day is base-10, using digits from 0 to 9.
In binary:
Each individual digit is called a bit (short for binary digit).
Binary numbers are read from left to right, with the least significant bit (LSB) on the far right and the most significant bit (MSB) on the far left.
Each bit represents a specific power of 2 depending on its position in the number.
This positional value principle forms the core of how binary values are interpreted and used in computing systems.
Positional value in binary numbers
Understanding how binary numbers work requires a firm grasp of positional notation. Just as in decimal where the position of each digit represents a power of 10, each position in a binary number represents an increasing power of 2.
Take the binary number 1011:
Practice Questions
FAQ
The number of bits used in a binary number directly affects the range of values it can represent. With n bits, the number of unique binary combinations is 2ⁿ. For unsigned binary numbers (which represent only non-negative values), this means the range is from 0 to (2ⁿ - 1). For example, with 4 bits, the values range from 0 to 15. However, if the binary representation is used for signed numbers (including negative values), the most common method is two’s complement (not covered in this section), which reduces the positive range to make room for negatives. In that case, the range becomes from -2ⁿ⁻¹ to (2ⁿ⁻¹ - 1). For example, 8-bit signed binary using two’s complement can represent values from -128 to +127. Thus, the more bits available, the wider the range of representable values, which is critical when storing data such as pixel values in images or numerical variables in programs.
Binary is more efficient in memory and storage because it aligns perfectly with how digital hardware operates. Each memory cell or flip-flop in a computer stores a single bit, which can be either 0 or 1. Storing decimal digits would require complex circuits capable of detecting and representing ten distinct states, increasing design difficulty, cost, and error rates. Instead, binary allows for minimal hardware—transistors need only distinguish between two states, making devices smaller, faster, and more reliable. Furthermore, binary enables bit-level manipulation, which is essential in low-level operations like shifting, masking, and compression. Memory addresses, data, and instructions are all stored in binary, and grouping bits into bytes (8 bits) and words (e.g. 32 bits) allows for efficient access and data transfer. This makes binary not only technically simple but also scalable, as it integrates easily with computer architecture, bus systems, and cache memory hierarchies.
When a binary value exceeds the allocated bit-width, an overflow occurs. This means the result of a calculation or stored value is too large to fit in the available number of bits. In such cases, the most significant bits are lost or wrapped around, potentially resulting in incorrect values without any error messages. For example, in an 8-bit register, the maximum value is 255. If an operation produces 256, it wraps around to 0. This can cause unexpected behaviour in programs, especially when dealing with counters, loops, or arithmetic operations. To handle overflow, some systems implement overflow flags in status registers, which can be used to trigger exceptions or warnings. In programming, developers often use larger data types (e.g. 16-bit or 32-bit integers) or apply modular arithmetic deliberately, such as in cryptography or game loops. Being aware of bit limits is essential for avoiding logic errors and ensuring data integrity.
Binary numbers are stored in memory using units of bits grouped into bytes (8 bits) and words, which can be 16, 32, or 64 bits depending on the architecture. Each byte has a unique memory address, allowing the CPU to locate and read data efficiently. When storing a multi-byte binary number (e.g. a 32-bit integer), the system must decide how to organise the bytes in memory. This leads to two conventions: big-endian (most significant byte stored first) and little-endian (least significant byte stored first). The CPU architecture determines which is used. When reading data, the system combines the bytes back into a single binary number using the appropriate order. Additionally, some architectures align multi-byte words at specific boundaries (e.g. 4-byte alignment) for performance optimisation. Understanding this is key when working with low-level memory operations, such as in assembly language or systems programming, where precision in data structure layouts is crucial.
Yes, binary numbers can represent real-world non-integer values such as fractions, but they require specialised formats like fixed-point or floating-point representation. In fixed-point, a binary point (like a decimal point) is placed at a known location within the binary number, allowing for representation of numbers with a constant scale. However, this has limited precision and range. More commonly, systems use floating-point representation, following standards like IEEE 754, which encodes a number using a sign bit, an exponent, and a mantissa (also known as a significand). This allows a very wide range of values, including extremely small and large numbers, and supports scientific notation in binary. However, some decimal fractions (like 0.1) cannot be exactly represented in binary, which may lead to small rounding errors. Despite this, floating-point binary is essential for applications in graphics, simulations, scientific computation, and anywhere continuous quantities like distance, time, or temperature must be stored and processed.
