Number Systems

Binary Numbers Demystified: How Computers Actually Think

An accessible explanation of binary: why computers use 1s and 0s, how to read binary, and understanding bits and bytes.

HandyUtils January 11, 2026 5 min read

Why do computers use 1s and 0s? It's not just a cliché from movies—binary is the foundation of all digital computing. Understanding binary helps you grasp how computers work at their core.

Why Binary? Transistors and Switches

Computers are built from billions of tiny transistors—electronic switches that are either ON or OFF. There's no "sort of on" or "maybe off." This two-state nature makes binary (base-2) the natural language of computers.

State Binary Meaning
OFF 0 No voltage / False
ON 1 Voltage present / True

It's like a light switch: simple, reliable, and fast. Using more than two states would be possible but would require distinguishing subtle voltage differences, making circuits slower and less reliable.

Bits and Bytes Explained

A bit (binary digit) is the smallest unit of data: a single 0 or 1.

A byte is 8 bits grouped together. Why 8? It's enough to represent:

  • All ASCII characters (which need 7 bits)
  • Numbers 0-255
  • A useful unit for memory addressing
1 bit:     0 or 1
1 byte:    8 bits (e.g., 01101001)
1 kilobyte (KB): 1024 bytes
1 megabyte (MB): 1024 KB
1 gigabyte (GB): 1024 MB

A byte's 8 bits are often shown in groups of 4 (called nibbles):

1010 1100 = one byte = 172 in decimal

Counting in Binary

Binary uses only 0 and 1, so you "carry over" much more often than in decimal:

Decimal: 0, 1, 2, 3,  4,  5,  6,  7,   8,   9,  10
Binary:  0, 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010

Each position represents a power of 2 (right to left):

Position:    7    6    5    4    3   2   1   0
Power of 2:  128  64   32   16   8   4   2   1

Binary:      1    0    1    0    1   1   0   1
Value:       128 + 0 + 32 + 0 + 8 + 4 + 0 + 1 = 173

Quick Conversion Practice

To convert binary to decimal, add the values where there's a 1:

1111 = 8+4+2+1 = 15
1000 = 8
0101 = 4+1 = 5
1010 1010 = 128+32+8+2 = 170

To convert decimal to binary, repeatedly divide by 2:

13 ÷ 2 = 6 remainder 1  → rightmost bit
6 ÷ 2 = 3 remainder 0
3 ÷ 2 = 1 remainder 1
1 ÷ 2 = 0 remainder 1  → leftmost bit

13 decimal = 1101 binary

Binary Arithmetic Basics

Addition

Binary addition follows the same rules as decimal, but with only 0 and 1:

0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (0, carry 1)

Example:

    1011  (11)
  + 0110  (6)
  ------
   10001  (17)

Two's Complement (Negative Numbers)

Computers represent negative numbers using two's complement:

  1. Write the positive number in binary
  2. Flip all the bits (0→1, 1→0)
  3. Add 1
+5 = 00000101
Flip: 11111010
Add 1: 11111011 = -5

This lets the same addition circuit handle subtraction!

How Text Becomes Binary

Every character has a numeric code (ASCII, Unicode) that's stored in binary:

'A' = 65 = 01000001
'B' = 66 = 01000010
'a' = 97 = 01100001
'!' = 33 = 00100001

The text "Hi" in binary:

'H' = 72 = 01001000
'i' = 105 = 01101001

"Hi" = 01001000 01101001

This is why computers are sometimes called "just fancy calculators"—at the lowest level, even text and images are numbers.

How Images Become Binary

Images are grids of pixels, and each pixel's color is stored as binary numbers.

For a 24-bit color image:

Red:   0-255 → 8 bits
Green: 0-255 → 8 bits  
Blue:  0-255 → 8 bits
Total: 24 bits per pixel

Pure red pixel: 11111111 00000000 00000000 (255, 0, 0)

A 1920×1080 image with 24-bit color:

1920 × 1080 × 24 bits = 49,766,400 bits = 6.2 MB (uncompressed)

Binary Prefixes (KB, MB, GB)

There's historical confusion between decimal and binary prefixes:

Prefix Decimal (SI) Binary (IEC)
Kilo 1000 1024 (Kibi, Ki)
Mega 1,000,000 1,048,576 (Mebi, Mi)
Giga 1,000,000,000 1,073,741,824 (Gibi, Gi)

This is why:

  • Your "500 GB" hard drive shows as ~465 GB in Windows (decimal vs binary)
  • Network speeds use decimal (1 Gbps = 1,000,000,000 bits/second)
  • RAM uses binary (8 GB = 8 × 1,073,741,824 bytes)

Bitwise Operations Overview

Computers manipulate individual bits using bitwise operations:

AND (&)

Both bits must be 1:

1010 & 1100 = 1000

Use: Masking, checking if a bit is set

OR (|)

Either bit can be 1:

1010 | 1100 = 1110

Use: Setting bits, combining flags

XOR (^)

Bits must be different:

1010 ^ 1100 = 0110

Use: Toggling bits, simple encryption

NOT (~)

Flip all bits:

~1010 = 0101

Use: Inverting, two's complement

Shift (<<, >>)

Move bits left or right:

1010 << 1 = 10100  (multiply by 2)
1010 >> 1 = 0101   (divide by 2)

Use: Fast multiplication/division, accessing specific bits

Fun with Binary

Binary in Pop Culture

  • "There are only 10 types of people in the world: those who understand binary and those who don't." (10 in binary = 2)
  • The Matrix's green rain is falling binary and Japanese characters

Secret Messages

Encode text as binary for a geeky message:

01001000 01100101 01101100 01101100 01101111 = "Hello"

Binary Birthday

What's your age in binary? 25 = 11001, 30 = 11110, 40 = 101000

Powers of 2

Memorize these—they appear everywhere:

2^0 = 1      2^5 = 32     2^10 = 1024
2^1 = 2      2^6 = 64     2^16 = 65536
2^2 = 4      2^7 = 128    2^20 = 1048576 (≈1M)
2^3 = 8      2^8 = 256    2^30 = 1073741824 (≈1G)
2^4 = 16     2^9 = 512    2^32 = 4294967296 (≈4G)

Summary

Binary is the language computers speak because of their physical nature—transistors that are simply ON or OFF. Understanding binary helps you:

  • Grasp how data is stored and processed
  • Debug low-level issues
  • Work with bitwise operations
  • Understand memory and file sizes

While you rarely need to count in binary as a developer, knowing how it works gives you deeper insight into the machines you program.

Want to convert numbers between binary, decimal, and hex? Try our Number Base Converter or Binary Encoder!

Related Topics
binary bits bytes base-2 computer architecture digital logic
Share this article

Continue Reading

Number Systems
Hexadecimal for Developers: Colors, Memory, and More

A practical guide to hexadecimal notation: why developers use hex, reading hex values, and everyday applications from color codes to debugging.

Data & Files
Understanding File Sizes: Bits, Bytes, and Beyond

A complete guide to digital storage units from bits to terabytes, including the confusing differences between MB and MiB.

Encoding
What is Base64 Encoding and When Should You Use It?

A complete guide to Base64 encoding: how it works, why it exists, and practical use cases for developers including data URIs, API authentication, and email attachments.