Asked in Computer Terminology
Why is 1 KB commonly said to be 1024 bytes instead of 1000 bytes?
A kilobyte is actually 1000 bytes. "kilo-" is an SI prefix meaning "1000".
- 1 km = 1000 meters
- 1 kg = 1000 grams
- 1 kB = 1000 bytes
When dealing with computer memory, the addresses for each memory location are typically binary numbers, which means the total number of addresses is a power of 2. It makes the most sense to use all of these positions, so the total capacity of a memory will typically be a power of two.
Since 210 is equal to 1,024, it is often approximated as "1 kilobyte" in speech, but this is just a shorthand, not a real definition.
RAM manufacturers treat this as a literal meaning instead of an approximation, though, and extend this to higher powers, which conflicts with the way units are used elsewhere. So a "1 GB" RAM IC has 230 = 1,073,741,824 bytes instead of 1,000,000,000 bytes, a 7% error. On the other hand, a 1 GB Flash memory actually does have around 1,000,000,000 bytes, as you would expect.
"kB" or "KB" can mean either 1024 bytes or 1000 bytes, depending on who you ask. Both meanings have been in use since the early days of computing, confusing users ever since.
kilo- means 1000, and has for centuries, so where did 1024 come from? The answer is binary addressing.
Your basic transistor, the foundation for all things computer, has 2 states (on/off), which is known as binary. So modern computers of all types use the binary numbering system (0/1 = off/on).
Memory addresses in computers are a number of bits wide. For instance, the old 6502 microprocessor had memory addresses 16 bits 'wide'.
With 10 bits, for instance, a computer can address 210 memory locations, which is 1024. With 16 bits, a computer can address 216 memory locations. So the number of memory locations is always a power of two. It wouldn't make much sense to make memory chips that don't use all of the addressable locations, so all memory is in powers of two. (This doesn't apply to other computer components, however. Hard drives, disk drives, DVDs, and other media, clock speeds and data rates and networking speeds are all measured in powers of 10.)
But 1024 is 210 (2 to the 10th power), conveniently close to 103 (1000). In computers, base-2 shows up over and over again. It's easier to approximate and say "1k" instead of 1024. 1 kilo is normally 1000, as per the metric system's prefixes.
In this case, the next higher size of memory chips was often 2x or 4x the previous size. This pulled folks away from the normal base-10 thinking toward base-2 thinking ... and we ended up with something that sounds like it is based on powers of 10, but is really based on powers of 2.
Officially, 1000 is the only valid meaning, and "k" was used by engineers for 1024 just as an approximation. (2048 bytes is equal to 2.0 kB, after all.) Over time, this approximation became used by marketing types as if it was actually defined as 1024, rather than just being used as an approximation.
In 1968, for instance, Donald Morrison talked about how it was confusing to tell laymen that doubling a 32K memory produced a 65K memory. He proposed to end the confusion by using the Greek letter κ (kappa) to mean 1024, but this never stuck. Instead, people started using capital K to mean 1024, which further increased confusion instead of helping.
Nowadays however, there is a new prefix to be used for the non-standard meaning:
- 1 kibibyte (KiB) is 1024 bytes
- 1 kilobyte (kB) is 1000 bytes
So too for the old megabyte which was 220 bytes:
- 1 mebibyte (MiB) is 1,048,576 bytes
- 1 megabyte (MB) is 1,000,000 bytes.
Higher units like terabyte have always been used with the 1000x meaning except in rare cases.