Math Tools Math Tools

Why Computers Use Binary

Why Computers Use Binary

By Math Tools ·

Why Computers Use Binary

If you optimize purely for mathematical efficiency, the best whole-number base for representing numbers is 3, not 2. In 1958, engineers at Moscow State University built a working ternary computer called Setun, and around 50 were produced.

Yet every computer you've used runs on binary. The reason isn't that 2 is mathematically best. It's that 2 is the easiest number for physics to get right, billions of times a second, in a noisy world.


Base 3 Is More "Efficient" Than Base 2

Mathematicians measure the cost of a number base with radix economy. Representing a number N in base b takes about log_b(N) digits, and each digit can be in b states. If hardware cost is proportional to digits × states:

Cost ∝ b × log_b(N) = (b / ln b) × ln N

The function b / ln b is smallest at b = e ≈ 2.718. Comparing whole numbers:

Base b / ln b
2 2.885
3 2.731
4 2.885
10 4.343

Base 3 wins, with base 2 and base 4 tied just behind it. Base 10 is far less efficient. So efficiency alone doesn't explain binary.


Reason 1: Two States Are Easy to Tell Apart

A digital circuit represents digits as voltage levels. With binary, a circuit only has to answer one question: is the voltage high or low?

For example, in a 3.3-volt system, anything below about 0.8 V might count as 0 and anything above about 2.0 V as 1. The wide gap between them is the noise margin. Electrical noise, temperature changes and aging components can nudge the voltage around, and the answer still comes out right.

Split the same voltage range into three or ten levels and each level gets narrower. Small disturbances start flipping digits. When a processor performs billions of operations per second, even a one-in-a-trillion error rate means frequent crashes.


Reason 2: Switches Are Naturally Binary

A transistor used in digital logic acts as a switch: on or off. Relays, vacuum tubes and transistors are all most reliable when they're pushed fully one way or the other.

Holding a transistor at a precise middle level is harder, slower and uses more power. Modern chips contain billions of transistors, and each one behaving like a clean on/off switch is what makes that scale possible.


Reason 3: Logic Is Binary Too

In 1854, English mathematician George Boole published The Laws of Thought, an algebra where variables are either true or false, combined with AND, OR and NOT.

For decades, Boolean algebra was a curiosity of logic. Then, in 1937, a 21-year-old MIT master's student named Claude Shannon wrote "A Symbolic Analysis of Relay and Switching Circuits." He showed that circuits of on/off switches could implement any Boolean expression, and therefore any logical or arithmetic operation.

The thesis has been called one of the most important master's theses of the 20th century. It meant that the same binary hardware could both store numbers and make decisions.


Binary Arithmetic Is Beautifully Simple

In decimal, a child memorizes a 10 × 10 multiplication table with 100 entries. In binary, the whole table is:

0 × 0 = 0
0 × 1 = 0
1 × 0 = 0
1 × 1 = 1

That's just the AND operation. Binary addition of two bits needs only XOR (the sum bit) and AND (the carry bit):

0 + 0 = 0,  carry 0
0 + 1 = 1,  carry 0
1 + 0 = 1,  carry 0
1 + 1 = 0,  carry 1

Chain these half adders and full adders together and you can add numbers of any size. Compare with the decimal multiplication tables, or look at binary multiplication tables to see how small they are.


An Insider Reference: Leibniz Saw It Coming

In 1703, German mathematician Gottfried Wilhelm Leibniz published "Explication de l'Arithmétique Binaire," a description of base-2 arithmetic. He was fascinated that every number could be written with only 0 and 1, and he noted parallels with the hexagrams of the ancient Chinese I Ching.

Leibniz even imagined a calculating machine in which marbles would fall through open holes to represent 1s and stay put for 0s. It took more than two centuries, plus Boole and Shannon, to turn that into electronics.


What About Bytes and Hexadecimal?

Binary is hard for humans to read. A 32-bit number is 32 digits long. Programmers group bits to make them manageable:

  • 8 bits = 1 byte, with 256 possible values
  • 4 bits = 1 hexadecimal digit, with 16 possible values

So the byte 11111111₂ is written as FF₁₆ or 255₁₀. Because 16 = 2⁴, each hex digit maps exactly to 4 bits, which makes hex a compact shorthand for binary. Try it with the binary to hexadecimal converter.


Two Concepts Worth Knowing

Bits of Information

A bit is the amount of information in a single yes/no answer. To pick one item out of N equally likely options, you need log₂(N) bits. That's why 20 yes/no questions can identify one item out of 2²⁰ ≈ 1 million.

Signal-to-Noise Ratio

Signal-to-noise ratio compares the strength of a signal with background noise. The lower it is, the fewer distinct levels you can reliably tell apart. Binary uses the minimum number of levels, making it the most noise-tolerant choice.


Quick Answer: Why Do Computers Use Binary?

Computers use binary because electronic switches are most reliable with just two states, on and off. Two widely separated voltage levels tolerate noise well, Boolean logic maps directly onto binary circuits, and binary arithmetic needs only simple gates. Base 3 is slightly more efficient in theory but far harder to build reliably.


Try Them Yourself

Write today's date as a binary number, then convert it to hex. You'll be thinking like a CPU designer.