What is binary?
Binary is a number system that uses only two digits: 0 and 1. Every piece of data your computer processes — text, images, videos, programs — is stored and transmitted as a sequence of these two digits. The reason computers use binary is simple: electronic circuits have two natural states, on (1) and off (0). Two states are far easier to represent reliably in hardware than ten.
How binary counting works
In the decimal system (base-10) we use daily, each position represents a power of 10: units, tens, hundreds, thousands. In binary (base-2), each position represents a power of 2: 1, 2, 4, 8, 16, 32, 64, 128, and so on.
| Binary position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Value (2^n) | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Binary to decimal: step-by-step method
To convert binary to decimal, write out the binary number, assign the positional values right to left starting at 1, multiply each bit by its positional value, and sum the results.
Example: Convert 1011 to decimal
- Position 3 (value 8): digit is 1 → 1 × 8 = 8
- Position 2 (value 4): digit is 0 → 0 × 4 = 0
- Position 1 (value 2): digit is 1 → 1 × 2 = 2
- Position 0 (value 1): digit is 1 → 1 × 1 = 1
- Total: 8 + 0 + 2 + 1 = 11
Binary 1011 = decimal 11. Let's verify: 11 in decimal is between 8 (1000 in binary) and 16 (10000 in binary), which checks out.
Decimal to binary: the division method
Repeatedly divide the decimal number by 2 and record the remainder each time. When the quotient reaches 0, stop. Read the remainders from bottom to top — that is your binary number.
Example: Convert decimal 25 to binary
- 25 ÷ 2 = 12 remainder 1
- 12 ÷ 2 = 6 remainder 0
- 6 ÷ 2 = 3 remainder 0
- 3 ÷ 2 = 1 remainder 1
- 1 ÷ 2 = 0 remainder 1
- Reading remainders bottom to top: 11001
Decimal 25 = binary 11001. Verify by reversing: 1×16 + 1×8 + 0×4 + 0×2 + 1×1 = 16 + 8 + 1 = 25. Correct.
Why computers use 8-bit bytes
A single binary digit is called a bit. Eight bits grouped together form a byte. One byte can represent 2⁸ = 256 different values (0–255). This range is enough to represent all 128 standard ASCII characters (letters, numbers, punctuation) with room to spare for extended characters.
Modern computers process 64-bit numbers (8 bytes) at a time, which is why "64-bit" appears in operating system descriptions. A 64-bit number can represent 2⁶⁴ ≈ 18.4 quintillion different values — enough to address more RAM than currently exists in the world.
Binary in everyday technology
IP addresses: An IPv4 address like 192.168.1.1 is actually four 8-bit binary numbers: 11000000.10101000.00000001.00000001. Subnet masks (255.255.255.0 = 11111111.11111111.11111111.00000000) define network boundaries in binary.
Colours in design: Web colours use hexadecimal (base-16), which is a compact representation of binary. #FF0000 (red) = 11111111 00000000 00000000 in binary — full red channel, zero green, zero blue.
File sizes: A kilobyte is 1,024 bytes (2¹⁰), not 1,000, because binary counting makes powers of 2 the natural unit boundaries. This is why a "500 GB" hard drive shows as 465 GB in your operating system.
Binary addition
Binary addition follows the same rules as decimal, but carries happen at 2 instead of 10: 0+0=0, 0+1=1, 1+0=1, 1+1=10 (write 0, carry 1).
1010 + 0111 = ?
Rightmost: 0+1=1. Next: 1+1=10, write 0 carry 1. Next: 0+1+1(carry)=10, write 0 carry 1. Leftmost: 1+0+1(carry)=10, write 0 carry 1. New column: 1.
Result: 10001 = decimal 17. Check: 10 + 7 = 17. Correct.