A binary number is a numeral expressed in base-2, using only the digits 0 and 1. Each digit represents a power of two, enabling computers to process data through electrical signals that are either off (0) or on (1).
Binary numbers form the foundation of all digital computation. They're not just theoretical-they're used in every device that runs software, from smartphones to satellites. A single bit-a binary digit-can be either 0 or 1. Eight bits make a byte, which can represent 256 different values.
The binary system is rooted in Boolean logic, where operations like AND, OR, and NOT map directly to binary arithmetic. This makes it ideal for circuit design, where voltage levels correspond to binary states. For example, a logic gate in a microprocessor evaluates inputs as high (1) or low (0) and produces an output based on predefined rules.
Each position in a binary number corresponds to a power of two, starting from 2⁰ on the right. To convert binary to decimal, multiply each digit by its place value and sum the results. For example:
Thus, 1011₂ equals 11₁₀. This conversion is fundamental in computing, especially when interpreting memory addresses or configuring network settings.
Binary also supports bitwise operations. For instance, performing a bitwise AND between 1011 and 1100 yields 1000. These operations are used in encryption, compression, and graphics rendering.
Binary data appears in several forms depending on context:
| Type | Use Case | Example |
|---|---|---|
| Unsigned integer | Memory addresses, counters | 01101001 (105 in decimal) |
| Two's complement | Negative numbers in computing | 11111111 (-1 in 8-bit signed) |
| Fixed-point | Audio and video processing | 0101.1010 (5.625 in decimal) |
Two's complement is the standard way computers store negative integers. To find the two's complement of a number, invert all bits and add 1. For example, -5 in 8-bit binary is calculated as:
This allows subtraction to be implemented as addition, simplifying processor design.
People often assume binary is just a programming tool. But it's deeply embedded in hardware. Every instruction a CPU executes begins as a sequence of 0s and 1s stored in memory.
Another misunderstanding is that binary numbers are always long. While large values require many digits-like 1111111111111111 for 65,535-short sequences are common. The binary representation of the letter 'A' in ASCII is 01000001, just eight bits.
Some confuse binary with hexadecimal. Hexadecimal (base-16) uses digits 0-9 and letters A-F. It's used to shorten binary strings-for example, 11110000 in binary is F0 in hex. Hex is not a different number system-it's a shorthand for binary.
Consider a home thermostat set to 72°F. The temperature sensor outputs a signal that gets converted into a binary number. The analog-to-digital converter samples the voltage 100 times per second and assigns a binary value to each reading. A 10-bit ADC can represent 1,024 distinct levels, allowing precise temperature tracking.
When you send a message via email, the text is encoded in binary using UTF-8. The word "Hi" becomes:
01001000 01101001
Each byte corresponds to a character. The receiver decodes the stream back into readable text.
I once debugged a malfunctioning IoT sensor that sent incorrect readings. The root cause was a corrupted binary packet. The sensor's firmware expected a 16-bit value, but due to a timing error, it received only 8 bits. The extra 8 bits were interpreted as garbage, leading to false alarms. Fixing the packet framing restored accuracy.
Binary is not the same as digital. All binary data is digital, but not all digital data is binary. Audio files, for example, are digital but use multi-level signals (e.g., 16-bit PCM audio has 65,536 amplitude levels). Binary is specifically base-2.
Also, binary numbers differ from binary codes. A binary code is a system of symbols mapped to values-like Morse code or BCD (binary-coded decimal). BCD encodes each decimal digit separately: 9 becomes 1001, not 1001 in pure binary. This avoids rounding errors in financial calculations.
Understanding binary isn't optional for anyone working with computers. It's the language of machines. From the simplest calculator to quantum processors, everything reduces to 0s and 1s.