Skip to main content
TF
By Rohit V.8 min readArticle

KB vs KiB and Bits vs Bytes — Data Units Explained

TF
ToolsFuel Team
Web development tools & tips
Rows of server hardware with storage drives in a data center

Photo by Unsplash on Unsplash

Why Your 500 GB Drive Isn't 500 GB

> Quick answer: A KB (kilobyte) is 1,000 bytes by the SI standard. A KiB (kibibyte) is 1,024 bytes, defined by the IEC. The mismatch is why a drive sold as "500 GB" (500 × 1,000³ bytes) shows up as roughly 465 "GB" in Windows — Windows is actually counting in gibibytes (1,024³) but still printing the label "GB". Separately, a bit is a single 0 or 1, and a byte is 8 bits, so an 8-bit value holds one byte. Network speeds are quoted in bits per second (Mbps) while file sizes are in bytes (MB), which is why a "100 Mbps" connection downloads at about 12.5 MB/s, not 100. Two different sources of confusion, one explanation.

I bought a 1 TB SSD a while back, plugged it in, and the operating system cheerfully reported 931 GB. My first thought was that I'd been ripped off. I hadn't — the drive really does hold a trillion bytes. The number just gets divided by 1,024 three times instead of 1,000, and nobody updated the label to match.


This comes up constantly once you start working with file sizes, buffers, and bandwidth. So here's the whole thing: bits versus bytes, the decimal-versus-binary prefix mess, and why every storage device on earth seems to lie about its capacity.

Bits and Bytes — Start at the Bottom

Everything in a computer is bits. A bit is the smallest unit of data — a single binary digit, either 0 or 1. On its own it's not very useful; you can't even represent the letter A with one bit.

Group eight bits together and you get a
byte. Eight bits give you 2⁸ = 256 possible combinations, which is enough to represent a single character of text in older encodings, a number from 0 to 255, or one channel of an RGB color. The byte is the fundamental addressable unit in almost every system — when a language says a value is "4 bytes," it means 32 bits.

The capitalization actually matters here, and it bites people constantly:


-
b (lowercase) means bit - B (uppercase) means byte

So Mb is megabit and MB is megabyte, and they differ by a factor of eight. This is the single most common source of "why is my download so slow" confusion. Your internet plan is sold in
bits per second because that's how the networking world has always measured throughput — a "100 Mbps" plan moves 100 megabits each second. But your download manager shows progress in bytes. Divide by eight and 100 Mbps becomes about 12.5 MB/s. Nothing's broken; the units are just different, and the marketing department picked the bigger-sounding one.

I've watched people file support tickets over exactly this. They pay for "100 megabit" service, see their browser downloading at "12 MB/s," and assume they're getting a tenth of what they paid for. They're getting precisely what they paid for — it just doesn't look like it unless you know the b-versus-B trick. Once you internalize that one factor of eight, half of the speed complaints you'll ever hear sort themselves out.

Kilo Means 1,000 — Except When It Means 1,024

Close-up of computer circuit board and memory chips

Photo by Unsplash on Unsplash

Here's where it gets genuinely messy, and it's not your fault for being confused — the industry did this to itself. Before the prefixes, though, it helps to have a feel for what these sizes actually represent, because the abstract math means more once you can picture it.

A single
byte holds one character of plain ASCII text — the letter `A`, a digit, a comma. A short tweet of 280 characters is roughly 280 bytes. A kilobyte is about a half-page of plain text, or a small icon. A typical megabyte holds a few seconds of decent-quality audio, a high-resolution photo after compression, or the entire text of a long novel several times over — text is astonishingly small once you strip the formatting. A gigabyte is a couple of hours of standard-definition video, or hundreds of thousands of those novels. A terabyte is where consumer drives live now, holding tens of thousands of photos or a large media library. Having these reference points in your head makes size numbers stop being abstract: when an API limits uploads to "5 MB," you instantly know that's fine for a photo but not for a video, without doing any arithmetic. I find that intuition matters more day to day than memorizing exact conversion factors.

In the metric system, the prefix
kilo means exactly 1,000. A kilometer is 1,000 meters. By that logic, a kilobyte should be 1,000 bytes, and the SI definition says exactly that.

But computers are binary, and powers of two don't line up neatly with powers of ten. Early engineers noticed that 2¹⁰ = 1,024 is *almost* 1,000, so they started loosely calling 1,024 bytes a "kilobyte" out of convenience. That worked fine until the numbers got big. At the kilobyte level the gap is tiny — 24 bytes. But the error compounds with each step:


- 1 KB (decimal) = 1,000 bytes vs 1 KiB (binary) = 1,024 bytes — about 2.4% off - 1 MB vs 1 MiB — about 4.9% off - 1 GB vs 1 GiB — about 7.4% off - 1 TB vs 1 TiB — about 10% off


That's why the discrepancy gets worse as drives get bigger. To kill the ambiguity, the IEC formalized
binary prefixes in 1999 (the IEC 60027-2 standard). Under that scheme:

-
kibi (KiB) = 1,024 bytes (2¹⁰) - mebi (MiB) = 1,048,576 bytes (2²⁰) - gibi (GiB) = 1,073,741,824 bytes (2³⁰) - tebi (TiB) = 2⁴⁰ bytes

So the "correct" usage is: KB for 1,000 bytes, KiB for 1,024. The
IEC's own page on binary prefixes lays out the full table. The trouble is that hardly anyone actually says "kibibyte" out loud — it sounds faintly ridiculous, and decades of habit are hard to break. So in practice you have to read context, which brings us to the drive problem.

Who Uses Which — and the Drive Mystery Solved

The reason your storage looks smaller than the box promised is that two camps measure differently and don't agree to disagree politely.

Storage manufacturers use decimal. A drive marketed as 500 GB contains 500 × 1,000³ = 500,000,000,000 bytes. That's an honest count using the SI definition of GB. From their angle, they're being precise — and there's a cynical read here too, since the decimal definition lets them print the bigger number on the box. A "2 TB" decimal drive sounds better than "1.82 TiB," even though they're the same hardware.

Windows uses binary but mislabels it. When Windows reports that same drive, it divides those 500 billion bytes by 1,024 three times — which gives gibibytes — but it prints the label "GB" anyway. So 500,000,000,000 ÷ 1,073,741,824 ≈ 465.7, and Windows shows "465 GB." The bytes didn't vanish; Windows just measured in GiB and called it GB. No storage was lost. Nobody lied about capacity. The two systems simply used different-sized "gigabytes" and only one of them admitted it.

The rest of the ecosystem is split:


-
macOS switched to decimal years ago, so it shows that same drive as roughly 500 GB — matching the box. Apple decided the marketing number and the displayed number should agree. - Linux is a mixed bag; many tools report binary sizes (often correctly labeled with KiB/MiB), and `ls -h` versus `ls --si` will literally give you different numbers for the same file. The `-h` flag gives you binary (1,024-based) sizes, while `--si` gives decimal — same file, two answers, and you have to know which flag you used. - RAM is always binary. A "16 GB" stick of memory really is 16 GiB (17,179,869,184 bytes), because memory is addressed in powers of two by physical necessity. This is the one place the binary meaning is universal, and it's why you never see oddly rounded RAM numbers — memory always comes in clean powers of two. - Network speeds are decimal bits, as covered above.

My rule of thumb: storage and bandwidth marketing numbers are decimal, RAM is binary, and operating systems are a coin flip you have to check.


This bites in real code, not just on spec sheets. Say an API hands you a file size as a raw byte count — `5242880` — and you want to show it as a human-readable size. Divide by 1,024 twice and you get exactly `5 MB` (technically 5 MiB). Divide by 1,000 twice and you get `5.24 MB`. Both are "right" depending on which convention you've decided to follow; what matters is that you pick one and stay consistent across your app, because mixing them is how you end up with a progress bar that says "4.8 of 5 MB" and never quite reaches 100%. I once shipped exactly that bug — the upload limit was checked in binary but displayed in decimal, so the number on screen never matched the number the server enforced, and users kept reporting that uploads "under the limit" were being rejected. The fix was one line: use the same base everywhere.


When I need to sanity-check a conversion — turning that byte count into a readable size, or converting between MB and GiB — I'll drop it into the
ToolsFuel unit converter rather than risk an off-by-1,024 mistake in my head. And if you're staring at a raw byte field in a JSON response and want to confirm the structure before doing math on it, the ToolsFuel JSON formatter makes the payload readable first.

If you've ever wondered why CSS measurements have their own version of this "which unit do I actually want" problem, I went deep on it in
CSS units explained — px, em, rem, vh. Different domain, same lesson: the unit you assume isn't always the unit you're getting, and a few minutes understanding the difference saves hours of confusion later.

Frequently Asked Questions

What's the difference between KB and KiB?

A KB (kilobyte) is 1,000 bytes under the SI standard, while a KiB (kibibyte) is 1,024 bytes under the IEC binary-prefix standard. The IEC introduced KiB in 1999 specifically to remove the ambiguity, since 'kilo' historically meant both. The gap is small at the kilobyte level but compounds — at the terabyte level decimal and binary differ by about 10%.

Why does my 1 TB hard drive show only about 931 GB?

Because the manufacturer counts in decimal (1 TB = 1,000,000,000,000 bytes) but Windows divides by 1,024 three times to get gibibytes and then labels the result 'GB' anyway. No storage is lost — the bytes are all there. Windows is really showing you 931 GiB and just printing the wrong unit. macOS uses decimal, so it shows the same drive as roughly 1 TB, matching the box.

What is the difference between bits and bytes?

A bit is a single binary digit, either 0 or 1, and a byte is 8 bits grouped together. Lowercase b means bit, uppercase B means byte, so they differ by a factor of eight. This matters because internet speeds are quoted in bits per second (Mbps) while file sizes are in bytes (MB), which is why a 100 Mbps connection downloads at about 12.5 MB/s.

Why is internet speed measured in bits and file size in bytes?

Networking has historically measured throughput in bits per second, so plans are sold in Mbps (megabits), while storage and files are measured in bytes. To convert a bit rate to a byte rate, divide by eight: 100 Mbps is about 12.5 MB/s. This single factor of eight explains most 'why is my download slower than my plan' confusion — the connection is fine, the units just differ.

Is RAM measured in binary or decimal?

RAM is always binary. A 16 GB memory stick really holds 16 GiB, or 17,179,869,184 bytes, because memory is addressed in powers of two by physical necessity. This is the one place where the binary meaning of the prefix is universal, unlike storage drives where manufacturers use decimal. When converting between these units, the [ToolsFuel unit converter](/tools/unit-converter) handles the binary-versus-decimal math for you.

Should I write KB or KiB in my own documentation?

If you mean 1,024 bytes, the technically correct unit is KiB, and using it removes all ambiguity for anyone reading your docs. In practice many teams still write KB for binary values out of habit, so the safest move is to state your convention once at the top. When precision matters — like documenting buffer sizes or memory limits — spelling out KiB versus KB prevents the exact 'why is this off by a few percent' bugs this whole topic causes.

Try ToolsFuel

23+ free online tools for developers, designers, and everyone. No signup required.

Browse All Tools