Binary, Bits & Bytes
Inside a computer, everything is stored as long rows of 0s and 1s: your photos, your songs, this page and even the letters you type. This way of writing numbers with only two digits is called binary.
You do not need binary to use a computer, but understanding it explains many everyday questions. Why is a pen drive smaller than the number on the packet? How big is a photo compared to a video? Why does a "100 Mbps" internet plan not download 100 MB every second? This lesson answers all three.
Why only 0 and 1?
A computer chip contains billions of tiny electronic switches. Each switch is either off or on. Computers use the digit 0 for off and 1 for on. With enough switches, any number, letter, colour or sound can be written as a pattern of offs and ons.
One single 0 or 1 is called a bit, short for binary digit. A bit is the smallest piece of data a computer can store.
Counting in binary
In normal counting (called decimal), each place is worth ten times the place to its right: ones, tens, hundreds. In binary, each place is worth two times the place to its right:
| Place value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Binary for 13 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
To read binary, add the place values that have a 1. For 1101, that is 8 + 4 + 1 = 13.
To write a number in binary, start from the largest place value that fits and subtract. For 13: 8 fits (5 left), 4 fits (1 left), 2 does not fit, 1 fits. So 13 is 1101.
| Decimal | Binary |
|---|---|
| 0 | 0 |
| 1 | 1 |
| 2 | 10 |
| 3 | 11 |
| 4 | 100 |
| 5 | 101 |
| 8 | 1000 |
| 10 | 1010 |
You can ask Windows to convert numbers for you in Terminal. The 2 means "base 2", which is binary:
[Convert]::ToString(13, 2)
[Convert]::ToInt32("1101", 2)1101 13
Excel and Google Sheets have the same feature as functions:
=DEC2BIN(13)1101
Bytes and characters
Bits are grouped in eights. A group of 8 bits is one byte. A byte can hold 256 different patterns, from 00000000 (0) to 11111111 (255).
Each letter you type is stored as a number. In the standard system computers use, called Unicode, the capital letter A is number 65, which in binary is 01000001. One English letter usually takes one byte. A Hindi letter such as क takes three bytes in UTF-8, the most common way of saving Unicode text, which is why a Hindi message is a little "heavier" than the same length of English.
KB, MB, GB and TB
Because bytes add up quickly, we use bigger units. Each step is roughly a thousand times bigger than the one before:
| Unit | Short | Size (as Windows counts) | Roughly enough for |
|---|---|---|---|
| Byte | B | 8 bits | One English letter |
| Kilobyte | KB | 1,024 bytes | A short text file or email without pictures |
| Megabyte | MB | 1,024 KB | One phone photo is a few MB |
| Gigabyte | GB | 1,024 MB | Around an hour of video at ordinary quality |
| Terabyte | TB | 1,024 GB | Hundreds of thousands of photos |
The last column is only a rough guide: a photo from a good phone camera can be larger, and video size depends a lot on quality.
PowerShell understands these units, so you can check the numbers yourself:
1KB
1MB
1GB1024 1048576 1073741824
Why your drive looks smaller
Here is the confusing part. Windows counts 1 KB as 1,024 bytes, because 1,024 is a power of 2 (2 multiplied by itself 10 times). Companies that make drives and pen drives count 1 KB as 1,000 bytes, the normal metric meaning of "kilo".
So a drive sold as 1 TB holds 1,000,000,000,000 bytes. Windows divides by 1,073,741,824 to show GB:
1000000000000 / 1GB931.322574615479
Nothing is missing. It is the same number of bytes, counted with a different unit. (Strictly speaking, the 1,024-based units have their own names, KiB, MiB and GiB, but Windows still labels them KB, MB and GB.) A little more space also goes to Windows itself and to recovery files, so a new laptop with a "512 GB" SSD shows even less free space on day one.
Bits per second: internet speed
Internet speed is measured in bits per second, not bytes. "100 Mbps" means 100 mega bits per second. Notice the small b for bits and capital B for bytes.
Since 8 bits make a byte, divide by 8 to get megabytes per second:
| Plan speed | Best-case download |
|---|---|
| 40 Mbps | 5 MB per second |
| 100 Mbps | 12.5 MB per second |
| 200 Mbps | 25 MB per second |
When Farhan in Lucknow downloads a 200 MB file on a 100 Mbps connection, it takes at least 200 / 12.5 = 16 seconds. Real speed is usually lower, because Wi-Fi signal, other devices and the website's own speed all matter.
Common mistakes
- Mixing up Mb and MB. Mb (megabits) is eight times smaller than MB (megabytes).
- Thinking a new drive is faulty because it shows less space. It is the 1,000 versus 1,024 difference, plus space used by Windows.
- Reading binary like a normal number.
10in binary is two, not ten. - Expecting a Hindi SMS to hold as many letters as an English one. Letters in Indian scripts need more space each, so one SMS fits fewer Hindi letters and a long message is split into parts sooner.
Key points
- Computers store everything as bits: 0 (off) and 1 (on).
- In binary, place values double: 1, 2, 4, 8, 16, 32, 64, 128.
- 8 bits make 1 byte; one English letter usually takes one byte.
- Windows counts 1 KB = 1,024 bytes, 1 MB = 1,024 KB, 1 GB = 1,024 MB.
- Drive makers count in thousands, so 1 TB shows as about 931 GB in Windows.
- Internet speed is in bits per second; divide Mbps by 8 for MB per second.
Exercise
- Convert 25 into binary by hand, then check your answer with PowerShell or
=DEC2BIN(25). - Convert the binary number
10010into decimal. - A 256 GB pen drive is counted in thousands by its maker. How many GB will Windows show (before any files are added)?
Show solution
- 25 = 16 + 8 + 1, so the binary is
11001.
[Convert]::ToString(25, 2)11001
10010has 1s in the 16 and 2 places: 16 + 2 = 18.- 256 GB from the maker is 256,000,000,000 bytes. Divide by 1,073,741,824:
256000000000 / 1GB238.418579101563
Windows shows about 238 GB. (The exact free space can be a little lower after formatting.)
Quick Quiz
1. How many bits are in one byte?
A byte is a group of 8 bits.
2. What is the binary number 101 in decimal?
101 has 1s in the 4 and 1 places: 4 + 1 = 5.
3. Why does a 1 TB drive show about 931 GB in Windows?
The bytes are the same; only the unit used for counting differs.
4. About how many megabytes per second can a 40 Mbps connection download at best?
Divide megabits by 8 to get megabytes: 40 / 8 = 5.
Learn Computer Fundamentals with a mentor
Free lessons get you started. Our Excel & Office Skills training adds real projects and code reviews from working developers.
- Project-based learning
- Mentor code reviews
- Free counselling call
