66

Possible Duplicate:
What is the difference between a kibibyte, a kilobit, and a kilobyte?

If 1 KB (kilobyte) can mean either 1000 bytes or 1024 bytes,

And 1 MB (megabyte) can mean either 1000 KB or 1024 KB,

doesn't that mean that 1 MB can either mean any of the one of the four below? :

  1. 1000 × 1000 = 1000000 bytes

  2. 1000 × 1024 = 1024000 bytes

  3. 1024 × 1000 = 1024000 bytes

  4. 1024 × 1024 = 1048576 bytes

Or is 2. and 3. not accepted so 1 MB could mean either only 1000000 bytes of 1048576 bytes?

Pacerier
  • 28,143

7 Answers7

110

First, there are two types of prefix when talking about digital information (read bytes): SI prefixes and binary prefixes.

SI prefixes

SI prefixes are powers of 1,000 (1,0001, 1,0002, 1,0003, etc.):

  • 1 kB = 1 kilobyte = 1,0001 bytes = 1,000 bytes;
  • 1 MB = 1 megabyte = 1,0002 bytes = 1,000,000 bytes;
  • 1 GB = 1 gigabyte = 1,0003 bytes = 1,000,000,000 bytes;
  • and so on.

As you can see, only SI symbols mega and above are capitalized. Therefore, KB is not a valid prefix.

Binary prefixes

Binary prefixes are powers of 1,024 (1,0241, 1,0242, 1,0243, etc.):

  • 1 KiB = 1 kibibyte = 1,0241 bytes = 1,024 bytes;
  • 1 MiB = 1 mebibyte = 1,0242 bytes = 1,048,576 bytes;
  • 1 GiB = 1 gibibyte = 1,0243 bytes = 1,073,741,824 bytes;
  • and so on.

As you can see here, every binary symbol is capitalized and an lower-case i is added before the B symbol to indicate that we are talking about kibibytes instead of kilobytes, mebibytes instead of megabytes, etc.


However, binary prefixes are not widely used, Windows doesn't use them at all.

What happens here is that Windows tells us that the hard disk drive has a capacity of 300,066,795,520 bytes which, according to Windows, equals 279 GB. However, we know that if 1,000,000,000 bytes = 1 GB, 300,066,795,520 bytes = ~300 GB = ~279.5 GiB.

Therefore, if you see 1 KB (which is wrong, remember) or 1 MB, assume we are talking respectively of 1 kibibyte and 1 mebibyte. Kb, kb, Gb, gb, etc. are also frequent, even though they represent bits (8 bits = 1 byte).


In fine, in no case can 1 KB or 1 MB have multiple values, even though the (bad) usage seems to tell the contrary.

rav_kr
  • 187
seriousdev
  • 1,340
14

The kilobyte is a base 10 measurement, so 1 kilobyte = 10 to the power of 3 = 1000 bytes.

Although this is not quite accurate to exactly measure physical data as they are stored in binary which is measured in base 2, and thus the kibibyte was established in 1999 to replace kilobyte when used in computer science context to mean 1024 bytes.

Kibibyte is a base 2 measurement, so 1 kibibyte = 2 to the power of 10 = 1024 bytes.

The same applies to megabyte (1 megabyte = 10 to the power of 6 = 1000000 bytes), which the base 2 measurement is mebibyte (1 mebibyte = 2 to the power of 20 = 1048576 bytes)

  • (1) applies to megabyte
  • (2) and (3) is not accepted
  • (4) applies to mebibyte
slhck
  • 235,242
9

Currently the use of "KB", "MB", etc to mean anything other than 1000 bytes, 1000 x 1000 bytes, etc is deprecated and contrary to most official standards. The new way of expressing 1024 bytes, 1024 x 1024 bytes, etc is KiB (kibibyte), MiB (mebibyte), etc. It's a mess, and context is essential to understand what is meant. See http://en.wikipedia.org/wiki/Kibibyte for a discussion of these issues.

kreemoweet
  • 4,742
7

Probably not, because it would be inconsistent use of the prefixes within a single number.

While the SI prefix k stands for 1000, but in IT is often used to mean 1024 (with some advocating binary prefixes), it makes no sense to alternative between these meanings in the same number.

Daniel Beck
  • 111,893
3

You are correct in your question. 1 and 4 are correct, 2 and 3 are not.

Basically, you define the "thousand" which is either 1000 or 1024 and use that for the multiplications. They don't get swapped around.

In base two (binary), the closest you can get to 1000 cleanly is 1024 (2^10). This is how computers actually think about things, so in memory (RAM), for example, 1MB would be 1048576 bytes.

In base 10, however, you can actually have 1000. Disk drives work like this and on an HDD, usually 1MB will be 1000000 bytes (though solid state works in binary).

Basically, it's just down to the fact that the computer and the storage device usually work slightly differently, so there are different definitions for the same thing.

1

So, here's the deal. (Most of) today's computers operate in base 2, not base 10. (Yes, I know there are exceptions, but they really are exceptional cases.) For our (your) purposes, all general purpose computers (and certainly, all consumer use general purpose computers) use base 2 for all internal processing. The fundamental unit is a bit which can be zero or one. Eight of these together make a byte; 16 a word. Now, this is generally speaking... 32-bit computers are generally thought of as using 32-bit "words", 64-bit computers, 64-bit words, and so on. Have you noticed? These are all powers of 2. A computer with one "K" or kilobyte of memory will always have 1024 bytes of memory. One megabyte of memory will always mean 1024 x 1024 bytes. Again, all are powers of 2. So a computer with 64 MB of memory will always have 64 x 1024 x 1024 bytes. When you see computers advertised for sale, the memory capacity (RAM) will always be based on powers of 2. You'll never see a video card, for example, claiming 1GB of RAM to mean one billion bytes.

Where the confusion was introduced, and what drives people crazy, is when disk drive manufacturers, in their quest to offer bigger and bigger drives said, "Hey! You know, in other areas (not computers), a K is 1000, and an M is 1,000,000." If a couple of guys were discussing the selling price of a car, for example, and one suggested, "I think '8K' sounds about right," the other would automatically understand that '8K' meant $8,000, (not $8,192). So, those disk drive manufacturers said, "Let's start advertising our products using those measures so they'll sound bigger." But the legal guys stepped in and said, "Wait a minute here. Virtually everyone who, you know, actually works with computers and understands how they work is going to cry foul." To which those clever advertising guys replied, "No problem. Well just put a tiny little asterisk next to the capacity on the box and in our documentation that says something like '* 1GB = 1,000,000,000 bytes'. Problem solved."

So here we are, with all of this confusion. Quoting from the wiki article above, referenced by @kreemoweet,

In most cases, the kilobyte continues to be used to refer to a power of ten as well as a power of two.

And the confusion continues. For practical purposes, you should probably assume that disk capacities are based on base 10 units of measure. Similarly, RAM capacities will (probably) always be based on base 2 units. For other kinds of devices and products, it'll probably depend upon the underlying technology and what the advertising folks think they can get away with. After all, bigger is better, isn't it?

For some additional reading, you might peruse the Timeline of binary prefixes. It won't make things any clearer, but it is a fun read.

BillP3rd
  • 6,599
0

Yes, as it's a syntactical disaster. This Wiki article explains the issue and include a table of the "new" words to be used. Here in the real world no one uses those terms. You have to use context to determine which definition you are looking at.

Jim B
  • 451