Binary confusion: kilobytes and kibibytes
04 Feb 2005When I created my Bandwidth Calculator, easily the most popular web tool I ever made, I came across the following problem: in computer technology there is a habit of using kilobyte (kB) as 1024 bytes (as KB), megabyte (MB) as 1024*1024 (1.048.576) bytes. Most of you might think this is correct, but it’s not. The International System of Units (SI) (that defines the kilo, mega, giga, … and milli, micro, nano prefixes) uses only base 10 values. A kilo is always 1000, even for bytes. In order to find a solution for the IT ‘contamination’ of using kilo for 210 instead of 103, the IEC introduced new units in 1998:
In 1999, the International Electrotechnical Commission (IEC) published Amendment 2 to “IEC 60027-2: Letter symbols to be used in electrical technology – Part 2: Telecommunications and electronics”;. This standard, which had been approved in 1998, introduced the prefixes kibi-, mebi-, gibi-, tebi-, pebi-, exbi-, to be used in specifying binary multiples of a quantity. The names come from the first two letters of the original SI prefixes followed by bi which is short for “binary”. It also clarifies that, from the point of view of the IEC, the SI prefixes only have their base-10 meaning and never have a base-2 meaning.
(from en.wikipedia.org)
So this is the correct usage for file, disk, memory size:
Kilobytes (kB) | 1.000 | Kibibyte (KiB) | 1024 |
Megabyte (MB) | 1.000 ^ 2 | Mebibyte (MiB) | 1024 ^ 2 |
Gigabyte (GB) | 1.000 ^ 3 | Gibibyte (GiB) | 1024 ^ 3 |
Terabyte (TB) | 1.000 ^ 4 | Tebibyte (TiB) | 1024 ^ 4 |
Petabyte (PB) | 1.000 ^ 5 | Pebibyte (PiB) | 1024 ^ 5 |
… | … | … | … |
The problem is: the industry has not adopted these standards. If Windows shows the size of a disk, it converts 28.735.078.400 bytes to “26.7 GB”. It should be either 28.7 GB, or 26.7 GiB. Remember the 1.44 MB floppy? It actually never existed: it is either 1.40 MiB or 1.47 MB.
On September 18 2003 Reuters has reported that Apple, Dell, Gateway, Hewlett-Packard, IBM, Sharp, Sony and Toshiba have been sued in a class-action suit in Los Angeles Superior Court for “deceiving” the true capacity of their hard drives. This of course was due to ambiguity of “GB” when used by software and hardware vendors. This precedent might prompt Apple to adapt binary prefixes in its Mac OS, as well as other companies to put pressure on Microsoft to adapt them in its Windows operating systems.
from members.optus.net
One could argue: people have always used the MB = 1024*1024 for disk drives, why change now? Well, clarity is a good reason, and unambiguity. NASA lost the Mars Orbiter because engineers had mixed metric speed (km/h) with English speed (mi/h). Don’t even get me started on miles per gallon.
So: a disk of 160 GB should have 160.000.000.000 bytes. And it is about 150 GiB. Get over it.