100

I'm working on a web app that will show the size of certain files, and I'm wondering if there's any consensus about how to report the units of bytes. Technically the IEC has weighed in with an official standard, but I'm not sure that's worth much.

Several options:

  • "1 KB" means 1024 bytes (as Windows would report it, traditional usage)
  • "1 kB" means 1000 bytes (as Mac OS would report it, IEC usage)
  • "1 KiB" means 1024 bytes (unambiguous, but perhaps unfamiliar terminology)

Not a huge deal since we're only talking a 2.4% difference for files in the KB range, but for MB the difference is ~5% and for GB it's ~8%.

10
  • 35
    Pretty much 0% of non-technical users will know what a KiB is, and the large majority are going to think what Windows reports (1024) is correct (if anything). KiB is more "technically" correct but in reality it's just a great way to confuse your users for no reason. To my knowledge the only non-Mac people to use 1000 bytes as a KB are Hard Drive manufacturers, who of course use the smallest possible definition of a kilobyte.
    – Ben Brocka
    Nov 11, 2011 at 3:34
  • 2
    I agree that "KiB" is a little obscure; I'm not crazy about it (although perhaps non-technical user wouldn't think that much about it if they saw an extra "i" in the middle).
    – Hank
    Nov 11, 2011 at 4:23
  • 8
    Quite often a number reported in KB or MB serves as an indication, not as an exact measurement. Unless the difference in reported numbers really, really matters, I wouldn't bother. Nov 11, 2011 at 7:20
  • 4
    @BenBrocka: Pretty much 0% of non-technical users will know that the k- in KB is supposed to mean 1024, either. It doesn't for units they are familiar with, like km and kg. Using k- to mean 1024 in a user interface is flat out wrong.
    – endolith
    Mar 28, 2012 at 20:06
  • 7
    Even technical users sometimes mix these up. Case in point: before I read the definition above, I was pretty sure KiB = 1000 bytes.
    – topher
    Aug 11, 2015 at 8:03

7 Answers 7

86

A number of issues factor into the perception of what a kilobyte is and how to word it.

The IEC standard names are useless: As Jeff Atwood notes there is simply no industry acceptance of KiB/MiB/GiB. Hard drive manufacturers and Macs are the only major players using the 1000 bytes definition and hard drive manufacturers have absolutely no incentive to differentiate KiB from KB; it makes their drives sound smaller. Macs and Windows have no incentive to use KiB because it's an unnecessary complication for the user. Note that it's been 12 years since the definitions were created, and they're not being adopted anytime soon.

Windows vs. Mac: Mac thinks (kilobytes are) different. If detecting the OS is a possibility, display a kilobyte as what the user's OS would. If you can't, the 1024 byte definition is always a good fallback, seeing that 70% of general users are on Windows. Of course your target market might be different.

Scale: The problem with the binary prefix vs the SI prefix is that as the numbers grow, so does the difference between values. Once you get into the gigabyte range, the difference between GB and GiB is substantial--many Windows users are quite disheartened to find their 1 terabyte hard drive is only 932 gibibytes in Windows. In my experience, most of them assume Windows is correct rather than the hard drive manufacturer--and they have a point, it is in the hard drive manufacturer's benefit to use the smallest possible measure for a kilobyte.

Enterprise or technical users are a special case. If your app is measuring disk or database usage on a server farm, that 8% difference for a GB is huge, and you should allow the user to specify how you display kilobytes, even including a KiB option. These are probably your only users who would care enough to differentiate.

Finally, let's assume people really do all think 1000 bytes is a kilobyte, in their heart of hearts. Since they know file size from what their OS reports, not from counting the bytes manually, using the uncommon 1000 byte count will add unnecessary complexity and your app will look wrong because it conflicts with what the computer says. Users only know how big a file is because their OS tells them.

9
  • 1
    Another important (but complex) thing to note here is that binary exponents were used for technical and performance reasons, clusters on your hard drive clusters are sized in binary increments, so even if you report 1000 bytes as a kilobyte you're treating the byte differently between OS and user, which isn't always ideal. Decimal notation seldom has a place in computer science, and this is one of the very few times that comes to the surface to the user, so it's a tricky issue.
    – Ben Brocka
    Nov 11, 2011 at 15:31
  • 4
    I also forgot Memory; even if your HDD uses 1000 byte KB, your memory has to use KiB. You're pretty much forced to adopt a second standard because of that. A chip offering 4 gigabytes of RAM can't be 4*10^9.
    – Ben Brocka
    Nov 11, 2011 at 15:54
  • 15
    +1 for "Users only know how big a file is because their OS tells them." Nov 11, 2011 at 17:16
  • 3
    No, the only places binary terminology makes sense is with RAM and CPU register/bus size, due their binary nature. Everything else: storage and networking, is more appropriately measured in decimal numbers as they have no intrinsic connection to binary. See endolith's comment for further detail. Jan 6, 2019 at 17:29
  • 3
    what bothers me is that people say "yes, KiB is correct but it's unfamiliar, so I wouldn't use it" but it's exactly these people that are responsible for it being unfamiliar
    – user829755
    Jan 11, 2019 at 22:34
26

An old (now deleted) Stack Overflow question covered exactly this. The consensus was:

  • 1 kB = 1000 bytes
  • 1 KiB = 1024 bytes

The source for this was the NIST reference on SI units.

I would use the more technically correct KiB. In other words, divide the number of bytes by 1024 and show that with KiB as the unit. I doubt it's important if users mistakenly think "20 KiB" is 20,000 bytes rather than 20,480.

2
  • 7
    It's not really a concensus so much as an official standard ... en.wikipedia.org/wiki/Kibibyte
    – jcolebrand
    Nov 11, 2011 at 15:37
  • 2
    The question link is dead
    – user76586
    Dec 10, 2015 at 21:38
13

Ask any non-technical friend how many bytes are in a kilobyte, and they'll say "1,000", because that's what kilo- means in every other context they're used to. 1,000 grams in a kilogram, 1,000 meters in a kilometer, etc. So don't mislead users by writing "k" when you mean "1024".

In most cases, there's no reason to use multiples of 1024 anyway. Users are not programmers, and file sizes are arbitrary numbers with absolutely no connection to powers of 2. It is much more logical to follow the SI standard and describe a 10,000 character ASCII text file as "10.0 kB", rather than "9.7KB". It's much more logical to describe a 160,041,885,696 byte hard drive as "160.0 GB" or "160,042 MB", rather than "149.1 GB" in one place and "152,628 MB" in another. How is that beneficial to anyone? This is why OS X and Ubuntu measure file sizes in multiples of 1000.

Using the non-standard programmer's jargon units confuses users when they can't burn 4.7 "GB" on a 4.7 GB DVD, can't fit 100× 10 "MB" files on a 1 GB flash drive, etc.

In the one case where powers of 2 actually makes sense (RAM sizes), use "KiB". It's an international standard and anyone not familiar with it can look it up easily.

2
  • I would argue that this only apply to English-speaking users, since we do not even use "kilo-" anywhere.
    – tsh
    Jan 24, 2018 at 3:51
  • 10
    @tsh, I'm german and we do use kilo- everywhere. Also, according to leo.org the translation of kilometre looks very similar in french, spanish, italian, portuguese, polish and russian.
    – user829755
    Jan 11, 2019 at 22:24
9

Why k should be used for 1000 and Ki for 1024.

A reviewer we will call "User's Buys Tests" has analyzed external storage drives. All along their test, they mention that all drives have some "60 GB of reserved, user unavailable space" (1), exact values listed in a per drive table so that the readers can make the best buy.

It turns out that the alleged difference is in fact 1.024^3×disk size. That's because those Testers do not know the difference between GiB with which the partitions are measured and GB with which the disk size is measured. They have carved that stupidity for everyone to see in a stone called PDF.

The KiB has been introduced not because of a whim but because some quantities are measured that way and others the kB way, and that it's not convenient to speak of "multiple of 1000 kilometers per hour" and "multiple of 1024 kilobytes". For another example, communication rates (what many erroneously call speed) are measured in kbps = 1000 bps (bits/sec) while one speaks of kBps = 1024 Bps (bytes/sec) where it should be KiBps. One does not multiply KiBps by just 8 to obtain kbps.
The reason why some persons did not notice that communication rates kbps are multiple of 1000 instead of 1024 is that they use k for 1024 in computer science which generally counts by powers of 2.

So, the KiB is not a matter of pedantry or anything, just of knowing exactly what one speaks about. And I'm surprised to see little mention of that duality in this discussion.

The fact is indeed that one usually deals with KiB and that, although it dispenses me to speak of "units of 1024 bytes", it seems a burden to add that "i" to what is used the most for the sake of what is used the least. But how could a disk formating program display its numbers without making the GB/GiB distinction? The annoying thing in the disk size confusion is that those drive manufacturers who are accused of overestimating drive sizes are those who are correctly using the international unit multiplier Giga in GB and that it's the other ones who are to blame for not using GiB. It's in fact much easier than switching to the metric system!

What I notice is that using the GB/GiB distinction make writing about them much easier already.

(1) not even wondering what that space could be used for; in fact, drive manufacturers are so scrupulous about disk sizes (in GB or in 1000000000 byte units if you prefer longer phrases) that the spare sectors used to hold the data of failing regular sectors are in surplus of the exact byte count.

3
  • 2
    According to Wikipedia, in the JEDEC standard, 1000 bytes is 1 kB, and 1024 bytes is 1 KB en.wikipedia.org/wiki/Kilo- but 1024 bytes is also known as a kibibyte, 1 KiB. Dec 7, 2015 at 15:40
  • 2
    @YvonneAburrow The JEDEC standard documents common usage, but then says "this practice frequently leads to confusion and is deprecated"
    – endolith
    Apr 20, 2020 at 12:50
  • 2
    @endolith fair enough - it is confusing! Apr 20, 2020 at 16:08
6

Make it customizable from a preferences panel. Perhaps use KB as 1024 as the default setting. As Ben Brocka said, KiB is little known.

Further more show the actual size in tooltips, e.g.

Abbreviated label: 42 KB

Tooltip: 43.212 bytes

1
  • 1
    Agreed on KB as default. Keep it simple.
    – PhillipW
    Nov 11, 2011 at 10:46
6

1 kB is 1000 bytes (Decimali.e. 10^3 is kilo)
1 KB/KiB is 1024 bytes (Binary i.e. 2^10)

we already know kilo- means 1000, so remember kibi- means 1024.

Google unit converter enter image description here reference

0

This is not complicated. List both sizes in my computer and show in full word the name instead of using cryptic abbreviations. KB vs kB is easily confused for the same thing. This has nothing to do with math but language. They do not speak correctly. If you can list cm an in on a ruler them you can do it on a computer screen. If you can use a combination ruler and read it then you can could read both sizes listed and go by the metric you choose.

Don't assume someones preferences and choose for them. Don't get them used to one metric and then switch and bait them once they understand that metric by constantly swapping between the two.

1
  • 3
    So by "full word", do you mean "kibibytes" for KB?
    – aioobe
    Nov 27, 2019 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.