HACKER Q&A
📣 daviddavis

How many bytes are in a kilobyte?


This topic came up recently at work and I had always considered a kilobyte to be 1,024 bytes. However, SI seems to differentiate between a kilobyte and kibibyte (the latter being 1,024 bytes):

https://physics.nist.gov/cuu/Units/binary.html

I'm curious how other developers define kilobytes/megabytes/etc.


  👤 thesuperbigfrog Accepted Answer ✓
https://en.wikipedia.org/wiki/Byte discusses the definitions recognized by different standards organizations and history of bytes and derived units.

I personally prefer the base-2 definitions despite the fact that they do not follow metric prefix naming.

The standard metric prefixes would make more sense if 10-bit bytes were used (one byte == one decabit == 10 bits).

That begs the question: Should we have metric bytes?


👤 mytailorisrich
"Traditionally", memory/storage uses kilo=1024, etc, and data transmission uses kilo=1000. So 32kB RAM means 32,768 bytes and 32 kbps means 32,000 bits per second.

Then at some point hard disk manufacturers decided to change and to use SI prefixes as well. Iirc that was when off-the-shelf HDDs reached GB scale.

This all lead to the creation of kibibytes, etc. which I think is clear and solves the confusion created by effectively using SI prefixes incorrectly.


👤 mattl
Kibibyte exists because some take kilobyte to mean 1000 not 1024.

I think hard disk makers have been using 1000 for some time.


👤 taubek
I've finished my high school in mid 90's. For me kb=1024 bytes. At that time there was no kibi bytes anywhere in the literature.