How the Binary Number System Works
The decimal system we use daily has ten digits (0–9) and each position is a power of 10. Binary is a base-2 system — each position is a power of 2.
Place values in binary
In binary, the rightmost digit represents 1 (2⁰), the next represents 2 (2¹), then 4 (2²), 8 (2³), and so on. The binary number 1011 means: 1×8 + 0×4 + 1×2 + 1×1 = 11 in decimal. Converting between the two systems is a core skill in computing.
Bits and bytes
A single binary digit is called a bit — the smallest unit of data. Eight bits form a byte, which can represent 256 different values (2⁸). A kilobyte is roughly 1,000 bytes; a megabyte is roughly 1,000,000. Modern devices store gigabytes or terabytes — billions or trillions of bytes — all as binary.
Why Base 2 Works
Computers are built from transistors — electronic switches that are either on (1) or off (0). Binary maps perfectly onto this physical reality. Distinguishing two states is far more reliable than distinguishing ten. Coding translates human-readable instructions into operations that ultimately execute as 0s and 1s.
How Computers Encode Data in Binary
All types of data — text, images, sound, and programs — are stored as sequences of 0s and 1s.
Text encoding
Each character has a numerical code. In the ASCII standard, the letter 'A' is 65 in decimal — 01000001 in binary. Unicode extends this to cover every character in every language. A text message is a sequence of character codes stored in this format.
Images and colour
Each pixel on a screen is represented by colour values. In a standard system, three bytes encode the red, green, and blue components of each pixel (values 0–255). A 12-megapixel photograph contains 12 million pixels, each stored as numerical values.
Sound and video
Sound is recorded as thousands of measurements per second — each one a number representing wave amplitude. Video combines image frames with audio tracks. Compression algorithms (like MP3, JPEG, and H.264) reduce file sizes without losing quality. Algorithms drive every stage of this encoding and decoding.
Binary in Networking and Security
This base-2 system extends beyond individual devices into how computers communicate.
IP addresses
Every device on the internet has an IP address. In IPv4, an address is 32 bits (four groups of 8 bits each) — a 32-bit number that routers use to direct traffic. The address 192.168.1.1 is 11000000.10101000.00000001.00000001 in binary.
Encryption and Logical Operations
Encryption algorithms operate on this data using logical operations — AND, OR, XOR, and NOT. These simple operations, applied millions of times, scramble data into unreadable ciphertext. The security of online banking and messaging depends on mathematical operations performed on numerical representations of data.
Data transmission
Data sent across networks travels as electrical pulses, light signals (in fibre optic cables), or radio waves — all carrying signals in base 2. The internet is, at its core, a system for transmitting data sequences reliably from one device to another.
Frequently asked questions
- Why does binary use base 2 instead of base 10?
- Computers use base 2 because transistors have two states: on and off. Representing two states is reliable and easy to engineer. Base 10 would require distinguishing ten voltage levels, which is far harder to do accurately at speed and scale.
- How do you convert a binary number to decimal?
- Multiply each digit by its place value (powers of 2, right to left) and add the results. For 1101: 1×8 + 1×4 + 0×2 + 1×1 = 13. To convert decimal to binary, repeatedly divide by 2 and record the remainders.
- What is hexadecimal and how does it relate to binary?
- Hexadecimal is base 16, using digits 0–9 and letters A–F. It is a shorthand for binary: each hex digit represents exactly four binary digits. Programmers use it to make long binary strings readable — the colour #FF0000 (red) is 11111111 00000000 00000000 in binary.
- Do all computers use base 2?
- All conventional computers use binary at the hardware level. Quantum computers are being developed that use quantum bits — qubits — which can represent 0, 1, or both simultaneously. But quantum computers are not yet general-purpose replacements for current binary architectures.