Binary is a base 2 numeral system. While the decimal system uses ten digits (0 through 9), binary uses only two:
- 0
- 1
Each binary digit is called a bit (short for "binary digit"). A bit is the smallest unit of information in digital electronics. It can represent two states:
| Binary Digit | Meaning (Conceptual) | Meaning (Electronics) |
|---|---|---|
| 0 | Off, False, No | Low voltage, open switch |
| 1 | On, True, Yes | High voltage, closed switch |
Because physical circuits naturally have two stable states, binary is a perfect match for digital hardware. Every modern computer, from desktop machines to game consoles, ultimately speaks binary.
Inside a computer, billions of tiny electronic components called transistors act as switches. Each transistor can be either:
- On (conducting current)
- Off (not conducting)
Trying to build reliable hardware that distinguishes ten different voltage levels (for decimal digits) would be extremely difficult and error-prone. Two levels are much easier to detect and keep stable. This is why binary is not just convenient, but practically necessary for digital electronics.
In short:
Binary, like decimal, is a positional number system. Each position in a binary number represents a power of 2, just as each position in a decimal number represents a power of 10.
Consider the binary number:
From right to left, the positions represent:
| Position (from right) | Power of 2 | Value | Digit | Contribution |
|---|---|---|---|---|
| 0 | 2⁰ | 1 | 1 | 1 × 1 = 1 |
| 1 | 2¹ | 2 | 1 | 1 × 2 = 2 |
| 2 | 2² | 4 | 0 | 0 × 4 = 0 |
| 3 | 2³ | 8 | 1 | 1 × 8 = 8 |
Add the contributions:
This is the core idea: each bit has a weight based on its position, and the total value is the sum of all weighted bits.
To convert a decimal number to binary, a classic method is repeated division by 2. At each step, you record the remainder (0 or 1). When you reach 0, you read the remainders from bottom to top.
Example: Convert 25₁₀ to binary.
| Step | Current Value | Divide by 2 | Quotient | Remainder |
|---|---|---|---|---|
| 1 | 25 | 25 ÷ 2 | 12 | 1 |
| 2 | 12 | 12 ÷ 2 | 6 | 0 |
| 3 | 6 | 6 ÷ 2 | 3 | 0 |
| 4 | 3 | 3 ÷ 2 | 1 | 1 |
| 5 | 1 | 1 ÷ 2 | 0 | 1 |
Now read the remainders from bottom to top:
This method works for any positive integer. For very large numbers, computers use more efficient algorithms, but the principle is the same.
Binary scales up into familiar data units:
| Unit | Definition |
|---|---|
| Bit | Single binary digit (0 or 1) |
| Byte | 8 bits |
| Kilobyte (KB) | 1024 bytes |
| Megabyte (MB) | 1024 KB |
| Gigabyte (GB) | 1024 MB |
Every file on a computer—text documents, images, music, programs—is ultimately stored as a long sequence of bits grouped into bytes and larger units.
Binary does not only represent numbers. It represents everything in a digital system. The meaning of a particular binary pattern depends on how the system interprets it.
Characters (Text)
Character encodings such as ASCII and Unicode map letters and symbols to binary codes. For example, in ASCII:
| Character | Decimal Code | Binary Code (8-bit) |
|---|---|---|
| A | 65 | 01000001 |
| a | 97 | 01100001 |
Images
Digital images are made of pixels. Each pixel has color information stored as binary values (for example, red, green, and blue channels). A photograph is essentially a large grid of binary color values.
Sound
Audio is stored by sampling the amplitude of a sound wave at regular intervals. Each sample is converted to a binary number. Playing the sound back means converting those binary numbers back into electrical signals and then into pressure waves.
Programs
Machine code instructions are binary patterns that tell the CPU what operation to perform (add, move data, compare values, and so on). High-level languages like C or BASIC are eventually translated into these binary instructions.
Binary is closely tied to Boolean logic, a system of algebra based on true and false values. In computers, true and false are represented by 1 and 0.
Common logical operations:
| Operation | Inputs | Output Rule |
|---|---|---|
| AND | A, B | 1 only if both A and B are 1 |
| OR | A, B | 1 if at least one of A or B is 1 |
| NOT | A | 1 if A is 0, 0 if A is 1 |
| XOR | A, B | 1 if A and B are different |
These operations are implemented in hardware using logic gates. By combining gates, computers can perform complex decisions, calculations, and control flows.
Binary arithmetic follows rules similar to decimal arithmetic, but the digits are only 0 and 1. Addition is the most fundamental operation.
Binary Addition Rules
| Expression | Result | Carry |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 | 1 | 0 |
| 1 + 0 | 1 | 0 |
| 1 + 1 | 0 | 1 |
When adding more than two bits (for example, when there is a carry), you apply the same rules and propagate the carry to the next position.
Example: Add 1011₂ and 0110₂
Step by step:
- Rightmost bits: 1 + 0 = 1 (no carry)
- Next bits: 1 + 1 = 0, carry 1
- Next bits: 0 + 1 + carry 1 = 0, carry 1
- Next bits: 1 + 0 + carry 1 = 0, carry 1
- Final carry becomes the new leftmost bit: 1
Binary addition is implemented directly in hardware using adder circuits. All other arithmetic operations (subtraction, multiplication, division) are built on top of addition and related logic.
Computers often need to represent negative numbers. The most common method is called two's complement. It allows positive and negative numbers to be handled using the same addition circuitry.
How Two's Complement Works
- Start with the binary representation of the positive number.
- Invert all bits (change 0 to 1 and 1 to 0).
- Add 1 to the result.
Example: Represent -5 in 4-bit two's complement.
With two's complement, addition and subtraction work naturally, and there is only one representation for zero. This makes it ideal for hardware design.
Binary can also represent fractional values. Two common approaches are fixed-point and floating-point.
Fixed-Point
In fixed-point representation, a binary point (similar to a decimal point) is placed at a fixed position. For example:
Floating-Point
Floating-point representation (such as IEEE 754) uses a sign bit, an exponent, and a mantissa (fraction). This allows computers to represent very large and very small numbers with a limited number of bits, which is essential for scientific computing and graphics.
Binary is the invisible foundation of nearly all modern technology:
- CPUs execute binary machine instructions.
- RAM stores binary states in tiny capacitors or transistors.
- Hard drives and SSDs store binary data as magnetic states or trapped charges.
- Networks transmit binary signals as electrical pulses, radio waves, or light.
- Graphics processors manipulate binary matrices to render images and animations.
Even systems that seem far removed from simple ones and zeros ultimately rely on binary at their lowest level.
Binary has remained the dominant number system in computing for several reasons:
- Reliability – Two states are easy to distinguish and maintain.
- Simplicity – Hardware to handle binary is straightforward and efficient.
- Scalability – Billions of transistors can work together using binary logic.
- Universality – Every digital device understands binary patterns.
It is not just a way of writing numbers. Binary is the language of the digital world, the alphabet from which all modern computation is built.
To recap:
- Binary is a base 2 system using only digits 0 and 1.
- Each bit represents a simple on/off state, ideal for electronic circuits.
- Binary positional notation uses powers of 2 to represent values.
- All digital data—numbers, text, images, sound, programs—is encoded in binary.
- Binary arithmetic and Boolean logic form the core of computer operations.
- Two's complement and floating-point extend binary to negative and fractional values.
Understanding binary is like peeking behind the curtain of every computer system. Once you see how everything reduces to bits, the digital world becomes much less mysterious.