Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why does 1KB equal 1024 bytes? I know that 1KB also stores 1000 bytes.

That is, I've been told that 1Kb equals 1024 bytes, but my professor says that it's 1000 bytes and that Linux doesn't use the "KB = 1024 byte" concept. Can anyone explain how these can both be true? I am confused. I'm trying to answer a question from my professor.

I have looked at the following questions:

What is the origin of K = 1024?
What is the difference between a kibibyte, a kilobit, and a kilobyte?
Is it true that 1 MB can mean either 1000000 bytes, 1024000 bytes, or 1048576 bytes?

but I haven't been able to find out on my own why this works.

share|improve this question

closed as not a real question by DragonLord, RedGrittyBrick, slhck, random Apr 29 '12 at 22:01

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Duodecimal? It is an untouched topic. Pros and cons etc. ? –  Aki Apr 29 '12 at 17:34
3  
-1 Question is unclear. User fails to explain what he's confused about in the linked topics. –  Daniel Beck Apr 29 '12 at 19:40
2  
It's all explained in the very first question you linked to. Tell us what exactly you didn't understand there, as Daniel said. –  slhck Apr 29 '12 at 21:21
1  
How exactly don't the answers you currently have address your problem? You need to tell those who answered you why their answers aren't sufficient — I'm sure they'll explain further. The point is: 2 to the power of ten is a "kilo" in binary, and it's 1024. Simple as that. A "KB" can mean both 1000 and 1024 — in order to make this clear, people invented the binary prefix –  slhck Apr 30 '12 at 16:56
1  
I don't mind helping with homework questions, but I think it would be polite to reveal that when you ask it. Also, I think you should try to understand the question, not only produce an answer that satisfies your instructor. –  fstx May 1 '12 at 6:17

5 Answers 5

up vote 4 down vote accepted

First off, 1 Kb = 1024 bits and 1 KB = 1024 bytes. It is important not to get bits and bytes mixed up. Remember, lowercase b is bits, uppercase B is bytes. This distinction alone will save you some confusion in the future. And for reference, 1 byte = 8 bits.

As far as the difference between 1000 and 1024 and why there is a variation, you're not going to get much better than wikipedia's article on binary prefixes.

Some key points are here:

Starting in about 1998, a number of standards and trade organizations approved standards and recommendations for a new set of binary prefixes, proposed earlier by the International Electrotechnical Commission (IEC), that would refer unambiguously to powers of 1024. According to these, the SI prefixes would only be used in the decimal sense, even when referring to data storage capacities: kilobyte and megabyte would denote one thousand bytes and one million bytes respectively (consistent with SI), while new terms such as kibibyte, mebibyte and gibibyte, abbreviated KiB, MiB, and GiB, would denote 1024 bytes, 1048576 bytes, and 1073741824 bytes respectively.1 However, as of 2011 adoption of the new terms has been slow and usage has been limited in the marketplace and in the press,[citation needed] with notable exceptions such as Linux operating systems, several textbooks2 and scientific research papers.

...

By the mid 1970s it was common to see K meaning 1024 and the occasional M meaning 1048576 for words or bytes of main memory (RAM) while K and M were commonly used with their decimal meaning for disk storage. In the 1980s, as capacities of both types of devices increased, the SI prefix G, with SI meaning, was commonly applied to disk storage, while M in its binary meaning, became common for computer memory. In the 1990s, the prefix G, in its binary meaning, became commonly used for computer memory capacity. The first terabyte (SI prefix, 1000000000000 bytes) hard disk drive was introduced in 2007.[26] The dual usage of the kilo, mega, and giga prefixes and their corresponding symbols K, M, and G as both powers of 1000 and powers of 1024 was recorded in standards and dictionaries. For example, the 1986 ANSI/IEEE Std 1084-1986[27] defined dual uses for kilo and mega. kilo (K). (1) A prefix indicating 1000. (2) In statements involving size of computer storage, a prefix indicating 210, or 1024. mega (M). (1) A prefix indicating one million. (2) In statements involving size of computer storage, a prefix indicating 220, or 1048576. The binary units Kbyte and Mbyte were formally defined in ANSI/IEEE Std 1212-1991.[28] Many dictionaries have noted the practice of using traditional prefixes to indicate binary multiples.[29][30] Oxford online dictionary defines, for example, megabyte as: "Computing: a unit of information equal to one million or (strictly) 1048576bytes."[31] The units Kbyte, Mbyte, and Gbyte are found in the trade press and in IEEE journals. Gigabyte was formally defined in IEEE Std 610.10-1994 as either 1000000000 or 230 bytes.[32] Kilobyte, Kbyte, and KB are equivalent units and all are defined in the current standard, IEEE 100-2000.[33] Byte multiples using powers of 1024 up to yottabyte are given by the on-line computing dictionary FOLDOC (Free On-Line Dictionary of Computing).[34] The hardware industry has coped with the dual definitions because of relative consistency: system memory (RAM) typically uses the binary meaning while magnetic disk storage uses the SI meaning. There are, however, exceptions and special cases. Diskettes use yet another "megabyte" equal to 1024×1000 bytes.[35] In optical disks, Compact Disks use MB to mean 10242 bytes while DVDs use GB to mean 10003 bytes.[36][37]

...

In the early days of computers there was little or no consumer confusion because of the sophisticated nature of the consumers and the practice of computer manufacturers to specify their products with capacities in full precision. For example, in 1965 IBM stated about the System/360 Model 75 that "Its main memory operated at 750 nanoseconds and was available in three sizes up to 1,048,576 characters of information."[38] One source of consumer confusion is the difference in the way many operating systems display hard drive sizes, compared to the way hard drive manufacturers describe them. As noted previously, hard drives are described and sold using "GB" or "TB" in their SI meaning: one billion and one trillion bytes. Many operating systems and other software however display hard drive and file sizes using "MB", "GB" or other SI-looking prefixes in their "binary" meaning, just as they do for displays of RAM capacity. (The earliest known presentation of hard disk drive capacity by an operating system using "KB" or "MB" in a binary sense is 1984;[39] earlier operating systems generally presented hard disk drive capacity in decimal digits with no prefix of any sort, for example, in the output of the MS-DOS or PC-DOS CHKDSK command.) The following three images show the discrepancy of reporting the identical disk capacity on the manufacturer's packaging (160 GB = 160×10003), the Windows XP disk manager (149.05 GB = 149.05×10243), and the drive properties display (152625MB = 152625×10242).

There is a handy tool at calculating the differences here. It allows you to select unit type and quantity and also choose between 1000 and 1024 definitions. It will give you some idea about how things differ. Sometimes a visual demonstration helps bring some clarity.

share|improve this answer
    
According to these, the SI prefixes would only be used in the decimal sense, even when referring to data storage capacities: kilobyte and megabyte would denote one thousand bytes and one million bytes respectively. You just proved yourself wrong.. –  Dan Mar 21 at 20:55

Computers count in binary, so powers of two keep appearing all the time. 2^10 is 1024.

Lets say a memory chip contain 512 bytes, then you need 9 bits/address lines to adress every byte in it. If you have 8 such chips, use can use 3 bits/address lines to select a one of the chips, and you get a 12-bit address space without holes.

As memory chips grew bigger, one needed to shorten the number, and the convention of kilo = 1024 was adopted.

Disk drive drive vendors use mega = 10^6 etc since that gives bigger numbers. Windows uses KB = 1024, MB = 1048576 and GB = 1073741824 for files size and disk free space.

(I am pretty sure that the 4K sectors that new disk drives use are 4096 bytes)

share|improve this answer
    
-1 for "since that gives bigger numbers". They measure in multiples of 1000 because it makes more sense to call 100,000,000,000 bytes "100 GB" than "93 GB" in one place and "95,367 MB" in another. –  endolith Feb 8 at 1:22

Depending on the storage mechanism it might be more natural to store data in powers of two (binary). If I want to store 1000 bytes in decimal as a binary number is would be 1111101000 But as you can see this is not good for storing the maximum number of bytes allowable if we are going to use 10 bits anyway, which would be 1111111111 or 1024 decimal bytes including zero.

1kB generally means one decimal kilobyte and is exactly 1,000 bytes.

1KiB generally means one binary kibibyte and is exactly 2^10 or 1024 bytes

1kb generally means 1000 (decimal) bits. There are 8 bits to a byte. (lower case b usually mean bit, while upper case B usually means byte.

When you see an i it is usually a binary multiple, although many manufactures do no adhere to this standard. This is why there is a great deal of confusion

share|improve this answer

1 KB = 1024 byes. 1 MB = 1024 KB 1GB = 1024 MB

1 Kilobit = 1000 bits

Yes, this can be confusing. And this is a very good question. Very few people actually know about this.

See this Wikipedia article for more detailed info. That will/should definitely help.

share|improve this answer
    
Short, simple and clear answer. It's just a convention: when talking about bytes kilo refers to 2^10, and anywhere else (particularly bits or bauds = bits/second) it's usually 10^3. An important exception: HDD capacity is measured in bytes, but the manufacturers' convention for kilo, mega, giga, tera, etc. is 10^3, 10^6, 10^9, 10^12, etc. –  elcodedocle May 3 '12 at 19:04

People needed something to call 1024 bytes because (especially in the early days of computers) it was an important amount that came up quite often. They chose to use k because 1024 was close to 1000. And for 1024*1024, another number that comes up often, they chose to use meg because 1024*1024 is close to a million.

The fact that outside of computing, k means exactly 1000 may confuse you, but it doesn't in any way prove that a kilobyte is 1000 bytes. A kilobyte is defined to be 1024 bytes and that is that.

share|improve this answer
4  
Incorrect. Kilo is a SI prefix meaning "1000 times" or "10^3 times". Kibi is the standard term for "1024 times". A kilobyte is technically defined by standards organisations as 1000 bytes, while those same organisations define a kibibyte as 1024 bytes. Jeff Atwood actually mentioned this very thing on his blog‌​. –  Bob Apr 29 '12 at 18:06
1  
Really? Check wikipedia... en.wikipedia.org/wiki/Kibibyte . Also when was the last time you bought a hard disk. They're measured as 1000s. No this has long been a confusion. Unfortunately it's only 1024 because of tradition. In the "early days" it wasn't even standard that there were 8 bits in a byte. Many software engineers are adopting the use of KiB to prevent there being any argument with scientists. –  couling Apr 29 '12 at 18:20
1  
I'm not saying everything uses the correct definition, unfortunately it's quite the opposite. But I am stating the correct definition as defined by the organisations that make this kind of stuff up. In other words, I'm refuting your last paragraph in terms of the official definition. –  Bob Apr 29 '12 at 18:23
2  
@Bob: The "kibi" et al prefixes are a relatively recent innovation and have not yet achieved widespread usage. It's still very common to refer to 1024 bytes as a "kilobyte", and 1,048,576 bytes as a "megabyte". It's also common to use "megabyte" to refer to 1,000,000 bytes, or even 1,024,000 bytes. This is exactly the confusion that the binary prefixes are designed to correct, but we're going to be stuck with ambiguous usage for a long time. –  Keith Thompson Apr 29 '12 at 18:24
2  
@Keith true, which is all the more reason to encourage their use wherever possible. Popular usage is different from the definition and the answer should indicate that, not state popular usage is the definition. –  Bob Apr 29 '12 at 18:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.