Why does 1KB equal 1024 bytes?

toutoupouts Posted messages 104 Status Member -  
 Anonymous user -
Hello,

I am currently learning the basics of computer programming and there's a silly question I can't seem to resolve:
Why is 1 kB = 1024 bytes when 1 byte is a combination of 8 bits, so normally 1 kilobyte should equal 1000 bytes, i.e. 8000 bits, right?
Can you explain it to me?

Thank you in advance

Configuration: www.cine-athome.forumpro.fr

8 answers

  1. Nyctaclope Posted messages 5295 Registration date   Status Member Last intervention   1 254
     
    Hello

    It's not easy to explain, but let's try..

    Yes, 1KB is (approximately, see further on) equal to 1000 bytes, or 1000 separate "packets" of 8 bits, but not 8000 bits, because the bits have different values depending on their position in the byte.
    The "box" on the right is worth 2 to the power of zero, which is 1 (yes, that's how it is!)
    The next one is worth 2 to the power of 1, which is 2, the third 2 to the power of 2, which is 4, and so on.
    This value is to be multiplied by the bit 0 or 1 that is in the box, and we add it all up..

    If you want to represent 1000, you only need a bit set to 1 in the eleventh "box," followed by 10 bits set to 0 in the others.

    In fact, you get 1024, which is 2 to the power of 10.
    So 1024 is represented by an "eleven" (11 bits), if I may say so, and not 8000 bits, which would be considerably more.

    In practice, in computing, the "preferred" multiples of 1000 are the powers of 2:
    1KB is 2 to the power of 10, which is 1024
    1MB is 2 to the power of 20, or 1024x1024 = 1,048,576

    The downside is that both systems are used, and 1KB is sometimes 1000, sometimes 1024, especially for hard disk sizes.

    The standard (not very widely used) is to use:

    KB = 1000 bytes
    KiB (kilo "computational") = 1024,
    and likewise MiB, GiB, etc..

    Hoping to have clarified things for you...

    Catch you later
    Nyctaclope
    2
    1. toutoupouts Posted messages 104 Status Member 6
       
      The "cell" on the right is worth 2 to the power of zero, which is 1 (yes, that's how it is!)
      The next one is worth 2 to the power of 1, which is 2, the third one 2 to the power of 2, which is 4, and so on.
      This value is to be multiplied by the bit 0 or 1 that is in the cell, and we add everything up...

      What do you call cell?
      0
    2. Nyctaclope Posted messages 5295 Registration date   Status Member Last intervention   1 254
       
      Re
      A byte consists of eight adjacent boxes, or eight positions, or eight whatever you want... Each box is to be filled with a bit of 0 or 1.

      Just like when you write a number in our so-called decimal system, you have on the right the box for "units," then the box for tens, etc...
      In decimal, you have access to ten "digits" 0 to 9
      In binary, you only have access to two "digits": 0 and 1, but that doesn't prevent you from counting as high as you want; it's a bit more complicated for you, but for the computer, it's simpler...

      See you
      Nyctaclope
      0
    3. Swiss Knight Posted messages 2257 Status Member 110
       
      It serves hard disk manufacturers, especially the GB/TB...

      long live marketing.
      0
  2. BmV Posted messages 43676 Registration date   Status Moderator Last intervention   4 963
     
    ===> https://www.commentcamarche.net/faq/4203-mythes-1-kilo-octet-1024-octets

    -=O(_BmV_)O=-   "What frightens me is not the oppression of the bad people, but the indifference of the good people" - Martin L. King
    Put the link back in line :o))
    0
  3. toutoupouts Posted messages 104 Status Member 6
     
    But why is it 2^n? That's what I don't understand.
    0
    1. Anonymous user
       
      Hi

      Because computing works in binary... So in powers of 2...
      0
  4. toutoupouts Posted messages 104 Status Member 6
     
    Thank you for your answers, but I'm having trouble picturing a bit; it's a "box" that can either take the value 1 or the value 0, right? But then for one byte, I have 8 boxes that can either take 1 or take 0, so it's an arrangement with repetition (mathematical theory)?

    Thank you in advance.
    0
  5. toutoupouts Posted messages 104 Status Member 6
     
    I'm sorry, but after reading and rereading the binary file, I still don't understand why 1 kibibyte is 2^10 (8192 bits) and not 1000 bytes, which would be 8000 bits. Can you explain that to me?

    Thank you in advance.
    0
    1. Nyctaclope Posted messages 5295 Registration date   Status Member Last intervention   1 254
       
      Re

      Hey my boy, for someone who can correctly install a NAS disk, aren't you leading us a bit on, just this once? ...
      A thousand Chinese with two eyes do not make a Chinese with 2000 eyes (variation on a theme by Confucius)
      See you later
      Nyctaclope
      0
    2. toutoupouts Posted messages 104 Status Member 6
       
      I'm sorry, I don't understand. Kilo is indeed 10^3, so 1 kilobyte should be equal to 1000 bytes; however, a byte is a combination of 8 bits (either 0 or 1), so 1 kilobyte = 8 + 8 + 8 + 8 + 8 +..... (up to 1000), which equals 8000 bits. I'm confused here, I'm sorry to bother you but I'm really interested in binary :-)

      Thank you in advance.
      0
    3. Nyctaclope Posted messages 5295 Registration date   Status Member Last intervention   1 254
       
      Re

      Here, a K equals 1024 (2^10), but the difference between 1000 and 1024 is incidental here.
      A kilobyte (Ko) means we are indeed dealing with 1000 bytes.
      A byte is a number (in practice, it denotes the number of a character, which is why we practically confuse bytes and characters). This number is written in bits.

      In total, you are indeed dealing with 1000 bytes, 8000 bits if you like, but these 8000 bits concern different bytes, and they ignore each other; they are not in the same "calculation," and are not lined up. A Ko is not a combination of 8000 bits, but 1000 combinations of eight bits.

      A list of 1000 numbers with 8 digits is not a number with 8000 digits.
      A m3 of sand is not a solid stone of 1 m3.
      A kg of potatoes is not a potato of 1 kg.

      And if we go back to bytes, the word "ab" consumes two bytes of eight bits each, but it is not encoded by a block of 16 bits.

      And I'm still not sure it isn't a joke, but you won't wear me down...
      I taught German to my cat, but he was the one who died first..:))

      A little effort Rémy! ..

      A+
      Nyctaclope
      0
    4. Anonymous user
       
      Hello

      Let's make it brief: 1 kilobyte (10^3) = 1000 bytes and 1 kibibyte (2^10) = 1024 bytes
      0
    5. Nyctaclope Posted messages 5295 Registration date   Status Member Last intervention   1 254
       
      Good evening
      Oh really, they managed to add VAT to it?
      By the way, is the number of bits limited in a discussion?
      See you later
      0
  6. Swiss Knight Posted messages 2257 Status Member 110
     
    it's because of the powers of 2.
    0