Wednesday, March 29, 2017

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



Answer



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.


No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...