Skip to content

File size - KB, MB, GB and KiB

File size tells you how much space a file takes up on a device's disk. It is measured in bytes and their multiples: kilobytes (KB), megabytes (MB), gigabytes (GB). Simple? Almost - because in computing, "kilo" sometimes means a thousand and sometimes 1024.

In short

  • A byte is 8 bits. File sizes are given in bytes (B), Internet speeds in bits (b).
  • 1 KB is 1000 bytes, 1 KiB is 1024 bytes. Windows says "KB" but counts in KiB - which is why a 1 TB drive shows up as 931 GB.
  • How heavy a file is depends on how much is in it and on the format it is saved in.

Where file size comes from

A computer stores everything as zeros and ones. A single zero or one is a bit, and eight bits make a byte - roughly what it takes to store one letter of plain text. So a file saying "Good morning" weighs a dozen or so bytes, and the text of the page you are reading, without images, a few dozen kilobytes.

After that it is all about content and format:

  • Text is light. A whole novel as a plain text file is about 1 MB.
  • Photos are heavier. A photo from a phone is a few MB, though the same image as WebP can be several times smaller than as PNG.
  • Video is the heaviest, being dozens of pictures every second - a minute of good-quality video runs to hundreds of MB.

The file format, which the file extension usually gives away, decides how the content is stored and whether it is compressed. The same photo can weigh 20 MB as a raw camera file, 4 MB as a JPG and 1 MB as a WebP - and on a phone screen you will not see the difference.

KB or KiB - where did my disk space go?

You buy a 1 TB drive, plug it into a Windows PC, and it says 931 GB. Where is the rest? 🙂

Nowhere - it was never missing. The drive maker counts the SI way: kilo is 1000, mega a million, tera a trillion bytes. Windows counts in powers of two: to it, "kilo" is 1024, "mega" is 1024 × 1024, and so on. A trillion bytes divided by 1024 three times comes to about 931 "gigabytes".

To keep the two apart, separate names were invented:

  • KB, MB, GB, TB - kilobyte, megabyte... - multiples of 1000,
  • KiB, MiB, GiB, TiB - kibibyte, mebibyte... - multiples of 1024.

In practice Windows still writes "KB" and "GB" while meaning KiB and GiB. macOS and most phones count in thousands, like the box does. You can convert one to the other quickly with a data size converter.

Bits on the Internet, bytes on the disk

Your provider promises 300 Mb/s, yet files download at about 37 MB/s. A scam? No - a small b means bits, a capital B means bytes. Connection speeds are quoted in bits and file sizes in bytes, so just divide by 8. In other words, a 100 Mb/s line downloads at most about 12.5 MB per second.

Size versus size on disk

A file's properties in Windows show two numbers: "Size" and "Size on disk". The second is often bigger, because the disk hands out space in blocks, usually 4 KiB each. A file holding a single letter still takes a whole block. With a few files that does not matter; with hundreds of thousands of tiny ones, it does.

When it matters to you

  • You send an attachment - many mailboxes cap a message at about 20-25 MB.
  • You upload photos to a website - lighter photos mean a faster site. You can shrink them with image compression without uploading them to any server.
  • You buy a drive, a phone or cloud storage - expect the system to show a little less than the box says.

file extension, bit, byte, compression, backups.

Advertisement