Files size units: "KiB" vs "KB" vs "kB"

  • 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%.

    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.

    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).

    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.

    Another option would be to simply show the size in bytes. 123.000.000 bytes for a file is pretty readable but this depends a lot on which kind of sizes you're working with. I'd go for sizes in MB and show a little explanation link

    How important is it for you(r users) to be precise? Also, are the users more Mac or more Windows? I wouldn't bother with KiB (didn't know what it meant until now). Personally, I'd go with 1024.

    @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.

    As a Windows user for most of my life I'd never considered this anything more than simplification for marketing purposes & didn't realize there was an actual under-the-hood difference on Mac. People don't like math, so rounding off the fluff makes sense to avg users. Until recently when Mac sales exploded and Gigabyte/Terabyte scales became the norm it wasn't an issue - nobody cared about a 64MB SD card skimping, but selling a $2500 Mac with a "3TB Drive" that only has 2.6TB available seems to many like false advertising. Also, seeing GB-size files listed in MB or KB is annoying. Again, math.

    Even technical users sometimes mix these up. Case in point: before I read the definition above, I was pretty sure KiB = 1000 bytes.

    @BenBrocka Its funny you should say this, found myself in _exactly_ the same position: I had no idea that there was a difference between `KiB` and `KB`, as a windows user, I am farmilliar with `KB` and always assumed this was the correct and most commonly used, without ever bothering to look into it until someone actually had to bring this up to me.

  • Ben Brocka

    Ben Brocka Correct answer

    10 years ago

    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.

    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.

    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.

    +1 for "Users only know how big a file is because their OS tells them."

    @BenBrocka Decimal notation seldom has a place in computer programming, but it is almost always the appropriate choice for a user interface. Computer guts and programmers are binary, but users are decimal. "Users only know how big a file is because their OS tells them" Yes, and OS X and Linux both use decimal.

    "Users only know how big a file is because their OS tells them." Unless you count the bytes by hand, so do all of us. :P

    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.

    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

License under CC-BY-SA with attribution

Content dated before 7/24/2021 11:53 AM