STX Binary
Last updated: 2026 (or so)
1. What Is Binary?

Binary is a base 2 numeral system. While the decimal system uses ten digits (0 through 9), binary uses only two:

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.

2. Why Computers Use Binary

Inside a computer, billions of tiny electronic components called transistors act as switches. Each transistor can be either:

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 = Simple hardware Binary = Reliable signals Binary = Fast switching
3. Positional Value in Binary

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:

1011₂

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 1 1 × 2 = 2
2 4 0 0 × 4 = 0
3 8 1 1 × 8 = 8

Add the contributions:

8 + 0 + 2 + 1 = 11 Therefore: 1011₂ = 11₁₀

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.

4. Converting Decimal to Binary

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:

Remainders (bottom → top): 1 1 0 0 1 25₁₀ = 11001₂

This method works for any positive integer. For very large numbers, computers use more efficient algorithms, but the principle is the same.

5. Bits, Bytes, and Larger Units

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.

6. Binary and Data Representation

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.

7. Binary and Boolean Logic

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.

8. Binary Arithmetic

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₂

1011 + 0110 ------- 10001

Step by step:

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.

9. Signed Numbers and Two's Complement

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

  1. Start with the binary representation of the positive number.
  2. Invert all bits (change 0 to 1 and 1 to 0).
  3. Add 1 to the result.

Example: Represent -5 in 4-bit two's complement.

Step 1: +5 in binary (4 bits) = 0101 Step 2: Invert bits = 1010 Step 3: Add 1 = 1010 + 0001 = 1011 Result: -5 = 1011 (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.

10. Fractions in Binary: Fixed and Floating Point

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:

10.11₂ = 2 + 0.5 + 0.25 = 2.75₁₀

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.

11. Binary in Modern Technology

Binary is the invisible foundation of nearly all modern technology:

Even systems that seem far removed from simple ones and zeros ultimately rely on binary at their lowest level.

12. Why Binary Endures

Binary has remained the dominant number system in computing for several reasons:

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.

13. Summary

To recap:

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.