File size is a measure of how much data a computer file contains or, alternately, how much storage it consumes. Typically, file size is expressed in units of measurement based on the byte. By convention, file size units use either a metric prefix (as in megabyte and gigabyte) or a binary prefix (as in mebibyte and gibibyte).
When a file is written to a file system, which is the case in most modern devices, it may consume slightly more disk space than the file requires. This is because the file system rounds the size up to include any unused space left over in the last disk sector used by the file. (A sector is the smallest amount of space addressable by the file system. The size of a disk sectors is several hundred or several thousands bytes.) The wasted space is called slack space or internal fragmentation. Although smaller sector sizes allow for denser use of disk space, they decrease the operational efficiency of the file system.
The maximum file size a file system supports depends not only on the capacity of the file system, but also on the number of bits reserved for the storage of file size information. The maximum file size in the FAT32 file system, for example, is 4,294,967,295 bytes, which is one byte less than four gigabytes.
|Traditional units||Decimal for comparison|
|Name||IEC||Binary||Number of bytes||Equal to||Name||IEC||Decimal||Number of bits||Equal to|
|Kibibyte||KiB||210||1,024||1024 B||Kilobit||kbit||103||1,000||1000 bit|
|Mebibyte||MiB||220||1,048,576||1024 KiB||Megabit||Mbit||106||1,000,000||1000 kbit|
|Gibibyte||GiB||230||1,073,741,824||1024 MiB||Gigabit||Gbit||109||1,000,000,000||1000 Mbit|
|Tebibyte||TiB||240||1,099,511,627,776||1024 GiB||Terabit||Tbit||1012||1,000,000,000,000||1000 Gbit|
|Pebibyte||PiB||250||1,125,899,906,842,624||1024 TiB||Petabit||Pbit||1015||1,000,000,000,000,000||1000 Tbit|
|Exbibyte||EiB||260||1,152,921,504,606,846,976||1024 PiB||Exabit||Ebit||1018||1,000,000,000,000,000,000||1000 Pbit|
|Zebibyte||ZiB||270||1,180,591,620,717,411,303,424||1024 EiB||Zettabit||Zbit||1021||1,000,000,000,000,000,000,000||1000 Ebit|
|Yobibyte||YiB||280||1,208,925,819,614,629,174,706,176||1024 ZiB||Yottabit||Ybit||1024||1,000,000,000,000,000,000,000,000||1000 Zbit|
Kilobyte (KB) (JEDEC), is sometimes referred to unambiguously as kibibyte (KiB)(IEC). Sometimes kB, with lower cased SI-prefix k- for kilo (1000), is used, then always equaling 1000 bytes.
A file system may display all sizes with the metric system with only kB on small files indicating it, while some file systems/operating systems would display sizes in, the traditionally used on computers, binary system for all sizes, e.g. KB, even if hard disk manufacturers may prefer to use the metric system (for e.g. GB = 1,000,000,000 bytes and TB = 1000 GB), to show higher capacity numbers for their products.
File transfers (e.g. "downloads") may use rates of units of bytes (e.g. MB/s) in binary rather than metric system, while networking hardware, such as WiFi, always uses the metric system (Mbits/s, Gbits/s etc.). of units of bits (and it needs to send more than the files themselves, so some overhead needs to be factored in), making superficially similar terms very incompatible.
- JEDEC Solid State Technology Association (December 2002). "Terms, Definitions, and Letter Symbols for Microprocessors, and Memory Integrated Circuits" (PDF). JESD 100B.01. p. 8. Retrieved 2009-04-05.
- "What is Slack Space?". IT Pro. 2010-01-19. Retrieved 2018-02-17.
- "Microsoft Extensible Firmware Initiative FAT32 File System Specification, FAT: General Overview of On-Disk Format". Microsoft. 2000-12-06. Retrieved 2011-07-03.