Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Representation of a Kilo/Mega/Tera Byte

I was getting a little confused with the representation of different units of bytes.

It is accepted throughout that 1 byte = 8 bits.

However, in a lot of sources I have seen that

1 kiloByte = 2^10 bytes = 1024 bytes

AND

1 kiloByte = 1000 bytes

Doesn't this contradict as in both cases it is stated that 1 byte is 8 bits...?

Different sources claim different reasons for these different representations, thus I am not sure what the most important/real reason is for this rather confusing difference in representation.

Can someone please explain and clarify?

like image 562
rrazd Avatar asked Jun 29 '11 15:06

rrazd


People also ask

How much is a tera?

Tera (1 trillion) comes from the Greek word teras or teratos, meaning "marvel, monster," and has been in use since approximately 1947. The prefixes exa (1 quintillion) and peta (1 quadrillion) were added to the International System of Units (SI) in 1975.

How many is a giga?

A gigabyte is equivalent to the following standard measurements: 1,000 megabytes (decimal) or 1,024 megabytes (binary); 1,000,000 kilobytes (decimal) or 1,048,576 kilobytes (binary); and. 1,000,000,000 bytes (decimal) or 1,073,741,824 bytes (binary).


1 Answers

It is accepted throughout that 1 byte = 8 bits

However, in a lot of sources I have seen that

1 kiloByte = 2^ 10 bytes = 1024 bytes

AND

1 kiloByte = 1000 bytes

To make sure we're all clear, your question is "Is a kilobyte equal to 1024 bytes or 1000 bytes?".

Doesn't this contradict as in both cases it is stated that 1 byte is 8 bits...?

This is irrelevant to the question.

So, let's begin. In SI (metric), the multiplier of 1000 is called kilo, abbreviated k. k always means 1000, never anything else.

When binary computers entered the world, we noticed that 2 to the power of 10 is 1024, which is conveniently close to 1000. Computer engineers decided to abuse this coincidence and say that kilo means 1024. By extension, they say that mega means 10242 (instead of the proper definition of 10002), and so on with giga, tera, etc.

While the difference between 1000 and 1024 is small for many purposes, there are times when exact answers are required, and this is where the abusive terminology hurts everyone. Only after decades after kilo=1024 got established did anyone really try to fix the problem. The IEC proposed new prefixes for the binary multipliers: 1024 = kibi, 10242 = mebi, 10243 = gibi, etc.

In summary, the notion that kilo=1024 is an abusive deviation from the consistent SI definition of kilo=1000. While kilo=1024 is popular in the computer industry, it is nevertheless wrong and should be replaced by kibi=1024. Or numbers need to be recomputed to reflect the true definition of kilo/mega/etc. (For example, "512 MB" of RAM is actually about 536.9 MB.)

Btw, don't use random capitalization; it's spelled kilobyte, not kiloByte.

References and links:

  • http://physics.nist.gov/cuu/Units/binary.html
  • http://en.wikipedia.org/wiki/Kilo-
  • http://en.wikipedia.org/wiki/Kilobyte
  • http://en.wikipedia.org/wiki/Kibibyte
  • http://xkcd.com/394/
like image 97
Nayuki Avatar answered Sep 17 '22 12:09

Nayuki