MATLAB Answers

Kilobytes to bytes conversion

34 views (last 30 days)
Andrea Campanella
Andrea Campanella on 7 Apr 2021 at 10:13
Commented: Andrea Campanella on 9 Apr 2021 at 11:08
I am confused, one kilobyte is equal to 1024 bytes or 1000 bytes?
I see different opinions about this definition, for example
I understand there are different definitions, my question is which one of the two is commonly used.

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 7 Apr 2021 at 10:39
Edited: Stephen Cobeldick on 7 Apr 2021 at 17:46
The SI system defines "kilo". The SI definition of "kilo" means 1000, and has never defined it to mean 1024.
Here are the SI prefixes:
etc. etc. repeated on one million other much less reputable websites.
However, long ago in a distant land some lazy computer programmers thought they would use the already existing prefix "kilo" to mean 1024 instead. An extremely misleading, incorrect, horribly awful and regretable decision intended to inflict maximum pain and confusion upon their decendents, and was thus immediately expanded to the other SI prefixes "mega", etc. This incorrect mapping (of powers of 1024 to powers of 1000) has the unfortunate effect of diverging in value as the prefixes increase in magnitude. Sadly, some of these mappings were formalized in various IEEE/IEC standards, but never in the actual SI standard itself (i.e. the actual source of the "kilo" prefix).
This is not just an academic discussion, there have been some major court-cases based on exactly this topic, with class-action suits involving claims of misleading advertising and quite large sums of money.
It also means that computer programmers forced themselves into the completely idiotic position of not knowing what they mean when they use these prefixes, which is entirely their own fault and rather defeats the purpose of having "standards". The confusion you ask to be clarified in your question cannot be clarified, because of that stupid decision many decades ago to use the wrong prefix. Everyone experiences that confusion, not just you.
For a thorough discussion on this topic, and an introduction to the correct prefixes for powers of 1024, see:
Feel free to do more reading on this subject, e.g. what the BIPM has to say on the matter: "These SI prefixes refer strictly to powers of 10. They should not be used to indicate powers of 2"
Note 1: Usage of "kilo", "mega", etc. in this incorrect fashion is restricted only/primarily to computer memory/drives (because these are typically measured in blocks of 1024). Outside of that realm, even computer programmers use SI suffixes with their correct meaning (e.g. a 1 Gbit/s Ethernet connection transfers data at nominal speed of 1000000000 bit/s).
Note 2: According to Wikipedia "'The prefix kilo is derived from the Greek word χίλιοι (chilioi), meaning "thousand"'. While some word meanings do change over time, this one still has the original meaning!
  4 Comments
Andrea Campanella
Andrea Campanella on 9 Apr 2021 at 11:08
many thanks guys

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!