How Does a Computer Understand Data?
At the physical level, a computer cannot read English, understand numbers, or see colors. All modern computer hardware is built from microscopic electronic switches called transistors. Because an electronic switch can only be ON (voltage present) or OFF (no voltage), the computer represents all information in the universe using just two digits: 0 and 1.
This two-symbol system is called the Binary system (from the Latin binarius, meaning "two by two").
Why Not Use Decimal (0 to 9)?
Why don't computers count in base-10 like humans? Because building electrical circuits that reliably distinguish between 10 different voltage levels (e.g. 1.1V vs 1.2V) is easily corrupted by electrical noise and heat. Checking whether voltage is simply HIGH (1) or LOW (0) is lightning fast, immune to interference, and completely reliable.
The Light Switch Analogy
Think of a bit (Binary Digit) as a single light switch on the wall: it can only be ON (1) or OFF (0). One switch gives you only 2 states. If you line up 8 switches in a row (a byte), you can create 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 256 unique combinations!
How Data Is Stored in 1s and 0s
Click individual bits to flip them between 0 (OFF) and 1 (ON), or type any number between 0 and 255.
The Three Languages of Computer Data
Human Intuition
Uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each column to the left is multiplied by 10 (1s, 10s, 100s, 1000s). We use this because humans have 10 fingers.
Hardware Native
Uses 2 digits: 0, 1. Each column to the left is multiplied by 2 (1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s). This directly maps to microscopic transistors in the CPU.
Programmer Shorthand
Uses 16 digits: 0-9 and A, B, C, D, E, F. Writing binary (1101 1010) is long and error-prone. Exactly 4 bits turn into 1 hex digit, making 0xDA much cleaner to read.
What About Numbers Greater Than 255? Multi-Byte Integers & Endianness
If a single 8-bit byte can only count up to 255, how does a computer calculate $1,000,000$ or track bank balances? The computer simply lines up multiple consecutive bytes together in memory:
Up to 65,535
$2^16$ unique states. Used for small audio samples.
Up to 4.29 Billion
The standard int in C and Java. Covers almost all everyday counts.
Up to 18.4 Quintillion
Virtually infinite. Used for 64-bit RAM addresses and timestamps.
When a 4-byte integer like 42 (0x0000002A in hex) is stored across 4 byte addresses:
- Little-Endian (x86 & modern ARM laptops): The Least Significant Byte comes first at the lowest address (
0x10: 2A,0x11: 00,0x12: 00,0x13: 00). - Big-Endian (Internet protocols & older mainframes): The Most Significant Byte comes first (
0x10: 00...0x13: 2A).
Common Beginner Misconceptions
- "A bit and a byte are the same thing."
Reality: A bit is a single 0 or 1 switch. A byte is 8 bits (256 values). File downloads are in Megabits (Mb), while files on disk are Megabytes (MB). 1 Byte = 8 Bits. - "Every programming language represents text with a null-terminator ('\0')."
Reality: In C, strings end with a null character'\0'. But modern languages (Python, JavaScript, Java, Go, Rust) store text with an explicit length field (e.g. length: 5) plus a byte buffer, making text operations safer and immune to buffer overflows! - "ASCII and Unicode are competing formats."
Reality: ASCII is an old 7-bit standard for English. Unicode is a universal catalog of every human symbol. UTF-8 is the encoding format that bridges them: it uses 1 byte for English ASCII characters, and 2 to 4 bytes for other alphabets and emojis!
A C program stores the 32-bit integer 42 (hex 0x0000002A) at RAM address 0x10 on an x86 (Little-Endian) computer. What byte value sits at the very first address, 0x10?
Lesson 02 Key Takeaways
- A bit is a binary digit (0 or 1); a byte is 8 bits (256 combinations).
- Binary is used because electronic switches (transistors) are reliably ON or OFF.
- Text is mapped to bytes via ASCII/Unicode; colors are stored as 3 bytes (Red, Green, Blue).
- Hexadecimal is simply a compact shorthand: 2 hex characters represent 1 byte.
Notessaved locally+
Notes stay in this browser. They are not uploaded.
Suggest an editLearning graph
Discussion
Loading discussion…
Sign in to ask a question.