EthicsComputerCourses
Join training +91 90532 10052

Binary, Bits & Bytes

Computer Fundamentals · Lesson 5 of 29 Beginner 7 min read Updated

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 value1286432168421
Binary for 1300001101

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.

DecimalBinary
00
11
210
311
4100
5101
81000
101010

You can ask Windows to convert numbers for you in Terminal. The 2 means "base 2", which is binary:

PowerShell
[Convert]::ToString(13, 2)
[Convert]::ToInt32("1101", 2)
Output
1101
13

Excel and Google Sheets have the same feature as functions:

Excel formula
=DEC2BIN(13)
Output
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:

UnitShortSize (as Windows counts)Roughly enough for
ByteB8 bitsOne English letter
KilobyteKB1,024 bytesA short text file or email without pictures
MegabyteMB1,024 KBOne phone photo is a few MB
GigabyteGB1,024 MBAround an hour of video at ordinary quality
TerabyteTB1,024 GBHundreds 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:

PowerShell
1KB
1MB
1GB
Output
1024
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:

PowerShell
1000000000000 / 1GB
Output
931.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 speedBest-case download
40 Mbps5 MB per second
100 Mbps12.5 MB per second
200 Mbps25 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. 10 in 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

  1. Convert 25 into binary by hand, then check your answer with PowerShell or =DEC2BIN(25).
  2. Convert the binary number 10010 into decimal.
  3. 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
  1. 25 = 16 + 8 + 1, so the binary is 11001.
PowerShell
[Convert]::ToString(25, 2)
Output
11001
  1. 10010 has 1s in the 16 and 2 places: 16 + 2 = 18.
  2. 256 GB from the maker is 256,000,000,000 bytes. Divide by 1,073,741,824:
PowerShell
256000000000 / 1GB
Output
238.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?

2. What is the binary number 101 in decimal?

3. Why does a 1 TB drive show about 931 GB in Windows?

4. About how many megabytes per second can a 40 Mbps connection download at best?

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