Menu

Memory & Storage

Units and File Sizes

Contents

  1. Data Storage Units
  2. Converting Between Units
  3. Text File Size
  4. Capacity Calculations

Data storage units are agreed sizes for describing how much data a computer can hold. They let you talk about a file or a drive in convenient amounts instead of counting individual bits.

Order of the units

From smallest to largest, the units are bit, nibble, byte, kilobyte (KB), megabyte (MB), gigabyte (GB), terabyte (TB) and petabyte (PB). A bit is the smallest unit of all; the nibble and byte are the next steps up before the amounts become much larger.

You choose the unit to suit the size. A short text document is measured in kilobytes, a photograph in megabytes, a film in gigabytes and a large data centre's storage in petabytes.

Steps of 1,000

From the kilobyte upwards, each unit is 1,000 times the size of the one before. The prefixes explain why: kilo means a thousand, mega a million, giga a thousand million and tera a million million, so every step multiplies by the same 1,000.

  • A kilobyte is 1,000 bytes.
  • A megabyte is 1,000 kilobytes.
  • A gigabyte is 1,000 megabytes.
  • A terabyte is 1,000 gigabytes.
  • A petabyte is 1,000 terabytes.

The steps from bit to nibble and from nibble to byte are much smaller than 1,000, so those first three units do not fit the pattern.

You may also see each step from the kilobyte upwards given as 1,024 times the one before. That value is accepted too, but do not mix 1,000 and 1,024 within the same calculation.

Converting between units means changing a value from one data unit to another while keeping the same amount of data. The number changes because the unit changes.

Bits and bytes

A bit is one binary digit and a byte is 8 bits. To convert bits to bytes, divide by 8. To convert bytes to bits, multiply by 8. For example, a short sensor reading is 640 bits, which is 640 ÷ 8 = 80 bytes, and 80 bytes is 80 × 8 = 640 bits.

Larger and smaller units

From bytes upwards, each unit is 1,000 times the one before: 1 kilobyte is 1,000 bytes, 1 megabyte is 1,000 kilobytes, 1 gigabyte is 1,000 megabytes, 1 terabyte is 1,000 gigabytes and 1 petabyte is 1,000 terabytes. To move to a larger unit, divide by 1,000 for each step. To move to a smaller unit, multiply by 1,000 for each step. So 5,600,000 bytes is 5,600 KB, then 5.6 MB. Going the other way, 3.5 TB is 3,500 GB, then 3,500,000 MB.

File sizes and comparisons

The standard formulas for text, image and sound files give a size in bits. Convert that answer by dividing by 8 to get bytes, then divide by 1,000 for each step up. Suppose a calculation gives 4,800,000 bits. That is 600,000 bytes, 600 KB and 0.6 MB. A calculation might be requested in bits, bytes, kilobytes, megabytes or gigabytes, so always finish by converting your answer to the unit asked for. To compare capacities or file sizes, convert every value to the same unit before comparing. A storage device has a fixed capacity: a 6 GB memory card holds 6,000 MB, so it has room for a 5,500 MB video collection but not for a 7,000 MB video collection.

Text file size in bits is found by multiplying the bits per character by the number of characters in the file. Each character is stored as a binary code, so the number of bits for one character tells you how much space each character takes. If a character uses 8 bits, a text file of 160 characters is 160 × 8 = 1,280 bits.

Make sure the bits per character value is in bits. If you are told each character uses a number of bytes, multiply by 8 first, because the formula needs a bit value. The number of characters is just a count, so use it as it is. The answer from the multiplication is in bits.

For more than one text file, work out the size of one file first, then multiply by the number of files. For example, 4 identical files each contain 120 characters and each character uses 8 bits. One file is 120 × 8 = 960 bits. Four files are 960 × 4 = 3,840 bits.

If a question asks for the size in bytes, the bit answer is converted afterwards; the multiplication itself always gives bits.

Capacity calculations work out whether a set of files will fit on a device, or how many copies of a file a device can hold. The key is always to get every value into the same unit before you add, compare or divide.

Storage needed for a set of files

Convert each file size to a common unit, add them up, then compare the total with the device capacity, which you also convert to that unit.

For example, a console has 8 games of 3.5 GB and 12 updates of 250 MB. The games need 8 × 3.5 = 28 GB. The updates need 12 × 250 = 3,000 MB, which is 3 GB. The total is 28 + 3 = 31 GB. A console with 32 GB free can hold them, leaving 1 GB spare.

How many files fit on a device

Put the capacity and the size of one file into the same unit, divide the capacity by the file size, then round down. Rounding down matters because part of a file cannot be stored: the leftover space is too small for one more whole file, so rounding up would promise a file that does not fit.

For example, a camera memory card has 128 GB free. Each RAW photo is 24 MB. Change the capacity to 128,000 MB, then do 128,000 ÷ 24 = 5,333.33 (to two decimal places). Round down to 5,333 whole photos. The remaining 0.33 of a photo is not enough for another photo, so it is wasted space.

Show your working

Write each conversion and each step as you go, keeping the units next to the numbers. Marks are awarded for the method as well as the final answer, so a correct answer with no working can still lose marks, and clear steps can earn marks even if a slip changes the final number.

Also useful