Mhonn YbañezSRE, DevOps, AI Engineer
 Today I Learned
Read the full page

Why is internet speed in bits but file size in bytes?

Posted
Tags
networking, fundamentals

A bit is a single 1 or 0, and a byte is 8 of them. Data in motion (internet, Wi-Fi) is counted in bits, and data at rest (RAM, disks, files) in bytes, so divide Mbps by 8 to get MB/s. The 8 goes back to IBM's System/360 in 1964, which made the 8-bit byte the standard.

I was downloading an 800 MB file on our 300 Mbps Wi-Fi. In my head, 800 ÷ 300 is under 3 seconds. It took a lot longer than that, and the download bar was showing a number nowhere near 300. Nothing was broken. I was mixing up two units that look almost the same.

The question I had

Why is my internet speed in one unit and my files in another, and how do I convert between them?

What I found

A bit and a byte

  • A bit (b) is the smallest unit of data: a single 1 or 0.
  • A byte (B) is a group of 8 bits. One byte holds one plain English character. (Accented letters take 2 bytes in UTF-8, and emoji take 4.)

The only visible difference is the case of the letter. Mb is megabits. MB is megabytes, 8 times bigger.

The 8x gap

Internet plans are sold in megabits per second (Mbps). Files are measured in megabytes (MB). So:

Mbps ÷ 8 = MB/s

My 300 Mbps connection tops out at 37.5 MB/s. 800 MB ÷ 37.5 MB/s is about 21 seconds, not 3. And that's the best case. Real downloads are slower again, because some of the connection goes to protocol overhead (packet headers, resent packets), and Wi-Fi rarely gets the full plan speed.

Why 8 bits?

8 bits give 256 different combinations (2^8). In the early 1960s, that was the sweet spot:

  • 6 bits was common, but too small. It gives only 64 values, not enough for upper and lowercase letters plus digits and punctuation.
  • 8 bits fit a full character set with room to spare. ASCII, from 1963, only needed 7 bits (128 characters). The spare bit later held accented letters and symbols.
  • 8 bits hold exactly two decimal digits (4 bits each), which was handy for business math.
  • 8 is a power of two, which keeps the hardware for addressing memory simpler.

Then IBM's System/360 in 1964 used the 8-bit byte across a whole family of computers. It sold so widely that the rest of the industry followed, and 8 bits has been the byte ever since.

The shortcut

Data is...Measured inExamples
At restBytesRAM, SSDs, file sizes
In motionBitsInternet plans, Wi-Fi, network links

The exception is the download bar in a browser or game launcher. It usually shows MB/s, because it's tracking how fast the file on my disk is growing. That's why mine never showed anything close to 300.

Reading and writing data

Drive speeds follow the same rule. A drive is storage, so it's rated in bytes per second. Rough sequential speeds:

DriveRoughly
Hard disk100 to 250 MB/s
SATA SSDabout 550 MB/s
NVMe SSD3,000 to 7,000 MB/s or more

The cable or port a drive connects through is a link, so it's rated in bits: SATA is 6 Gb/s, USB is 10 Gbps, and Thunderbolt is 40 Gbps. At rest vs in motion again.

A few more things I didn't know:

  • Reading is usually faster than writing. An SSD has to erase a block of flash before it can rewrite it. Many SSDs write into a small fast cache first, so a big copy starts fast and slows down once that cache fills.
  • Order matters more than size. One big file read in order (sequential) is fast. Thousands of small scattered reads (random) are much slower, which is why drives also list IOPS, operations per second.
  • A download is a chain: network, then memory, then disk. The slowest link sets the speed. On my 300 Mbps connection (37.5 MB/s), any modern drive keeps up, so the network was my bottleneck. On a 10 Gbps fiber line (1.25 GB/s), an old hard disk would become the bottleneck instead.

How this connects to token speed

This tied straight back to my Mac mini post, where running a model had two phases: prefill (reading the prompt) and decode (writing the reply).

A model's size is bits per weight times the number of weights. At 16 bits, each weight is 2 bytes, so a model with 27 billion weights is about 54 GB. Quantized to 4 bits, each weight is half a byte, and the same model is about 14 GB. Quantization literally means fewer bits per weight, and it's how a big model fits on a small box.

Decode is a read problem. To write each token, the chip reads every weight from memory. It's the download chain again, with memory as the slowest link:

memory bandwidth (GB/s) ÷ model size (GB) ≈ the most tokens per second

200 GB/s ÷ 20 GB is about 10 tokens per second. Both sides are in bytes, so no dividing by 8 this time. Fewer bits per weight means a smaller model, and a smaller model means faster decode.

Prefill isn't about data size. A token is roughly 4 characters of English, so a 50,000-token prompt is only about 200 KB of text, smaller than one photo. Yet that was the 9-minute wait in the Mac mini story. The prompt's tokens are processed together, so the weights are read once for the whole batch. What costs time is the math on every token, so prefill is limited by compute, not bandwidth. Like a sequential read, doing it in one big pass is what makes it efficient.

Same lesson, different units: find the bottleneck. For my download, it was the network. For writing tokens, it's memory bandwidth. For reading a long prompt, it's compute.

One more mismatch: 1,000 vs 1,024

There's a second, smaller gap. Drive makers count 1 GB as 1,000,000,000 bytes. Windows counts it as 1,073,741,824 (2^30). So a 1 TB drive shows up as about 931 GB. Nothing is missing. It's the same KB vs KiB difference from my back-of-the-envelope post. (macOS switched to the 1,000 count years ago, so a 1 TB drive shows as 1 TB on a Mac.)

Takeaway

Lowercase b is bits, which is how data moves. Uppercase B is bytes, which is how data is stored. Divide the Mbps by 8 for the best case, then expect a bit less. And when a transfer feels slow, find the slowest link in the chain, because that's the one setting the speed.