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?

5
  • 3
    Did you know there is −0 (negative zero) and +0 (positive zero)? en.wikipedia.org/wiki/Signed_zero
    – Aki
    Jan 1, 2012 at 18:07
  • 4
    The only place I've seen different prefixes mixed are the 1.44 [something which isn't mebibyte and isn't megabyte] floppies.
    – AndrejaKo
    Jan 1, 2012 at 18:07
  • Aki yes but I don't understand what you are trying to say?
    – Pacerier
    Jan 1, 2012 at 18:49
  • "If numbers aren't beautiful, I don't know what is." -- Paul Erdős
    – Aki
    Jan 1, 2012 at 19:22
  • 4
    Please, 'kB', not 'KB'. Jan 1, 2012 at 22:08

7 Answers 7

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.

11
  • 3
    Maybe you should add, that when talking about data transfer rates (in bit/s), one typically uses base-10 prefixes, e.g. Gb/s actually means "one billion bits per second."
    – Frank
    Jan 1, 2012 at 18:13
  • 3
    The binary prefixes are relatively new, and it's still very common to use the SI prefixes to refer to powers of 2. I think a lot of people aren't even aware of the binary prefixes. @Novox makes a good point: even people who use GB to mean 1048576 bytes of storage typically use Gb/s to mean 1000000000 bits per second. The invention of the binary prefixes didn't make all usage consistent. Jan 1, 2012 at 18:58
  • 5
    @kubanczyk: I don't disagree that it's laziness -- but laziness isn't necessarily a bad thing. We need a way to refer to storage in units of 1024, 1048576, or 1073741824 bytes, and before the (relatively recent) invention of the binary prefixes (Ki, Mi, Gi), re-using the SI prefixes (K, M, G) was the only reasonable way to do that. And we did that for so many years that the K, M, G prefixes are still ambiguous. It would have been better to use binary and SI prefixes consistently from the beginning, but that's not what happened. Jan 1, 2012 at 19:29
  • 2
    @kubanczyk Don't get me wrong, I /am/ a strong proponent of correct unit usage. Still, I don't think that "it's obvious". If it really were, there would be no questions as that one, right?
    – Frank
    Jan 1, 2012 at 21:16
  • 3
    Hmmm lets try it the other way around, shall we? Look what happened with 8 bits. Instead of calling it decabit and insisting that deca- sometimes means in IT 8 not 10, somebody invented a new term and called it a byte. Voila! Same solution was possible with 1024 if not 65536.
    – kubanczyk
    Jan 1, 2012 at 22:41
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
4
  • 13
    While this is technically correct, I would like to point out that in common usage, nobody says kibibyte or mebibyte, and when talking about 'kilobytes', people refer to the unit that Windows or the OS displays, which is kibibytes. The only place I have regularly seen kilobytes used correctly is on harddrive capacities, which frustrates users to no end. Jan 1, 2012 at 16:53
  • 4
    Yes, but only because their operating system doesn't use the SI prefixes "correctly."
    – Frank
    Jan 1, 2012 at 18:09
  • 2
    Still, MB can mean either 1,000,000 or 1,048,576 bytes. While not correct, it is widespread. CC @DarthAndroid
    – Daniel Beck
    Jan 1, 2012 at 18:34
  • Ah, 1998... when Pluto was a planet and a kilobyte was 1024 bytes.
    – Skrymsli
    Jun 25, 2018 at 22:18
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.

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.

2
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.

7
  • 2
    are you sure it's only pure marketing? maybe it's also related to the structure/organization of storage itself.
    – barlop
    Jan 1, 2012 at 18:43
  • 3
    -1 It's not a marketing thing and it wasn't to make disc drives sound bigger. That's a widely-propagated but nonetheless wholly false explanation. It's also an inference based upon gross ignorance of the subject. The International Electrotechnical Commission and Institute of Electrical and Electronics Engineers actually set out the rationale, which is to do with making different engineering disciplines speak the same language and not confuse one another, in 1997 in an IEEE Standards Bearer article. This is very much a practical engineering matter.
    – JdeBP
    Jan 1, 2012 at 19:22
  • 4
    My experience working for Miniscribe and later Maxtor in the 1980s and 90s as an engineer informs me otherwise. As computer engineers, we tend to gravitate towards powers of 2. A byte will always be 8 bits. As @barlop adds, unlike main computer memory, rotating disk drives can have widely diverse structure/organization. Even more so since drive technology has advanced such that the number of sectors per track varies from the inner to outer edge of the recording surface. Note that sectors still have 512 bytes. (That pesky power of 2 again).
    – BillP3rd
    Jan 1, 2012 at 19:47
  • 1
    That is a lack of experience: a narrow and myopic view of engineering. Go and read the IEEE Standards Bearer article. It's precisely the sort of blinkered "But people always use powers of two." thinking, that then goes horribly wrong when it hits the engineering majority that is not blinkered like this, that this was and is aimed squarely at. As I said, this is a practical engineering matter, and you ironically demonstrate the very problem that it was aimed at. It's not marketing, and it's not about making anything sound bigger. That's total fabricated rubbish. Don't believe it.
    – JdeBP
    Jan 2, 2012 at 9:08
  • 1
    @JdeBP sure engineers definitely came up with the terms kibibyte e.t.c. that's demonstrable. And what proportion of engineers in the hard drive world use it I don't know. I'd have thought perhaps they'd know by context what they mean by kilobyte and wouldn't need the mouthful of kibibyte, or perhaps not. It looks like BillP3rd thinks they'd know and it'd be base2, and you think they need to specify to know amongst themselves. But marketing would've chosen to use the smaller unit, the decimal prefix on the package. I wonder if marketing were doing that even before that IEEE article.
    – barlop
    Jan 3, 2012 at 15:01
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.

11
  • 4
    -1 for that "no-one". I use them here in the real world, and I'm far from alone.
    – JdeBP
    Jan 1, 2012 at 17:54
  • 1
    If the average consumer asked a sales person the memory capacity of a computer they were thinking of buying and was told "4 gibibytes," they would have no idea what was meant. Similarly, the vast majority of people would never say the words out loud "gibibyte, tibibyte, pibibyte, etc." Seriously, try saying "gibibyte" out loud three times as fast as you can. I can say that for myself, at least, I've never heard them. (For context, I work for a large software company that you've probably heard of and routinely deal with volumes of data in the terabyte and petabyte scale.)
    – BillP3rd
    Jan 1, 2012 at 18:18
  • +1 for mentioning those funny terms and that most don't use them and use context
    – barlop
    Jan 1, 2012 at 18:40
  • 1
    "no-one" means "no-one", kid, and isn't magically changed by context to mean something other than what the word means. It's a falsehood however you try to chop it.
    – JdeBP
    Jan 1, 2012 at 19:09
  • 1
    @JdeBP - sorry Jdebp but wishing doesn't make it so. The very existance of the kibibyte term is proof that there was (and still is) confusion over what is meant. I'm sorry you've been stuck with this term for a decade (must have been rough finding harddrives with kibibyte values in 2000). I would also suggest you work on editing that wiki article I referenced - clearly they must be all wrong about the lack of usage too (they must have left you off the polling list).
    – Jim B
    Jan 2, 2012 at 19:15

Not the answer you're looking for? Browse other questions tagged .