You can view the actual size of your file by opening file properties in File Explorer. If you have ever noticed, file properties show two different types of sizes for the same file, namely, Size and Size on disk. The Size on disk is usually larger than the actual file size. But in some cases, it may be the same or less than the actual file size. In this article, I will talk about the difference between Size and Size on disk on a Windows PC.
Size vs Size on disk difference explained
Before discussing the difference between “Size” and “Size on disk” in detail, let’s see the basic differences between these terms. Here, I will also show you some calculations that will give the exact and approximate result for the “Size on disk.” The screenshot below shows a file’s Size and “Size on disk”.
Size represents the actual size of a file. In simple words, it is the size of data a file holds. Size can be increased or decreased based on the data a file has. For example, if you create a blank text file, it will show you the size of 0 bytes. But as you start writing text in it, its size will also start increasing.
Size on disk shows the number of bytes a file has taken when you store it on a hard drive. Based on the Allocation unit size, you will see different Size on disk for the same file. Usually, the “Size on disk” is greater than the actual size of a file. To understand this, you need to understand the calculations. But before I show you calculations, knowing how data is stored on a hard drive is necessary.
How is data stored on a hard drive
When you store data on a hard drive, Windows converts it into Binary values, i.e., 0 and 1. These values are stored on a hard drive in clusters. Cluster size represents the small amount of disk space that is used to store a file. In Windows, usually, three types of File Systems are available: NTFS, FAT 32, and exFAT. All these File Systems support different allocation unit sizes. Based on the selected File System and its Allocation unit size, the “Size on disk” is calculated. Windows displays the same in File properties after this calculation.
You can select a cluster size while formatting a hard drive or a hard drive partition. If no cluster size is specified, Windows takes the default value for the cluster size and formats the hard drive or hard drive partition.
When you store a file, it is stored in clusters. Based on the file size (the number of bytes a file holds), it is distributed in clusters for storage, which determines the “Size on disk.” For example, if you want to store a file of size 5 KB on a hard drive with NTFS File System and the cluster size (Allocation unit size) 1024 bytes, the 5 Kilobytes are divided and stored in different sets of clusters with each cluster holding 1024 Bytes of data. The number of bytes remaining empty on the last cluster will be wasted. That’s why the “Size on disk” is usually greater than the actual file size.
Calculations for the Size on disk
Now, let’s see some calculations for the Size on disk so you can understand this topic better. I have done some calculations for the text files of different sizes on different cluster sizes on the NTFS File System. Here, I will show you the same and try to explain these calculations.
The calculation for the Size on disk when the Allocation unit size is 4096 bytes
I took a text file of size 24223 bytes and copied it to a USB flash drive with NTFS File System and the Allocation unit size of 4096 bytes. The Allocation unit size is the Cluster size for the USB flash drive. When I opened the properties of the text file, I saw the following details:
- Size – 24223 Bytes
- Size on disk – 24576 Bytes
You can see the same information in the above screenshot. As I have explained above in this article the “Size on disk” is usually greater than the actual size of a file. This is because the clusters are wasted during the file storage. Let’s see the calculations behind the scenes.
The actual file size is 24223 bytes and the selected Cluster size is 4096 bytes. Now, Windows stores this file in clusters. This means that 24223 bytes are distributed on the disk in the sets of 4096 clusters. I am saying “sets of 4096 cluster” because each cluster (allocation unit) can hold up to 4096 bytes of data.
If I divide 24223 bytes by 4096 bytes, I will get the following result:
24223/4096 = 5.9138 bytes
From the above result, it is clear 5 sets of clusters are fully occupied and the last 6th set has some empty clusters. Windows does not use these empty clusters to store other data. Due to this, these clusters are a waste. But if you overwrite data in the same file, Windows will use the same clusters.
Now, 5 sets of 4096 clusters are completely occupied. This gives us the following value:
5 x 4096 = 20480 bytes
Our data has 24223 bytes in total. Out of this, 20480 bytes are occupied completely in the 5 sets of clusters. Hence, the remaining bytes of our data are:
24223 - 20480 = 3743 bytes
Windows will fill all these 3743 bytes in the last set of the cluster, the 6th cluster in our case. Each cluster can store 4096 bytes. Hence, the remaining empty clusters are:
4096 - 3743 = 353 bytes
Now, these remaining or empty bytes are added to the actual bytes our file has. This will give us the actual result (the “Size on disk”).
353 + 24223 = 24576 bytes
In the above result, the “Size on disk” shows that 24576 bytes (6 sets of clusters with each cluster can store up to 4096 bytes) are completely occupied. But actually, only the 5.9138 part of the 6 sets of clusters is used to store data, and the remaining is wasted.
The calculation for the Size on disk when the Allocation unit size is 8192 bytes
Now, I took another file and also changed the Allocation unit size of my USB flash drive from 4096 bytes to 8192 bytes.
The above screenshot shows the following details of the file:
- Size – 5202 bytes
- Size on disk – 8192 bytes
Here, the calculation is easy. Because here the file size is smaller than the Allocation unit size, it will completely fit in only 1 set of clusters with an allocation size of 8192 bytes, and the remaining bytes will be wasted. Hence, Windows is showing 8192 bytes as the Size on disk for this file.
The calculation for the Size on disk when the Allocation unit size is 1024 bytes
Now, let’s see what happens if I reduce the Allocation unit size from 8192 bytes to 1024 bytes for the same file. I formatted my USB flash drive with a cluster size of 1024 bytes and copied the same file into it.
Have a look at the following file properties:
- Size – 5202 bytes
- Size on disk – 6144 bytes
Here, the cluster size is less than the total file size, the number of bytes in our file is distributed on the hard drive in the sets of clusters with 1024 bytes. Here, each cluster can hold up to 1024 bytes.
If I divide 5202 bytes by 1024 bytes, I will get the following result:
5202/1024 = 5.08 bytes
This means that 5 sets of allocation units with 1024 bytes each are fully occupied and the remaining bytes are filled in the next set.
5 sets of 1024 bytes = 5 x 1024 bytes = 5120 bytes
5120 bytes are completely written on the disk. Let’s calculate the remaining bytes to be written on the disk.
5202 - 5120 bytes = 82 bytes
Windows will write the 82 bytes in the last 6th set of clusters having an allocation size of 1024 bytes. Hence, the remaining bytes in the last set of the cluster will remain empty.
Remaining bytes, 1024 - 82 = 942 bytes
These remaining or empty bytes are added to the actual bytes our file has. This will give us the actual result (the “Size on disk”).
5202 + 942 = 6144 bytes
This is how the “Size on disk” is calculated. I have shown the calculation of “Size on disk” for only one file.
Why is there a big difference between Size and Size on disk in some cases?
When you copy files on a hard drive, Windows does not copy all the files at the same time. It copies files one by one by filling bytes in allocation units. After writing data, Windows calculates the empty or waste allocation units and adds them to the actual file size to display the Size on disk.
This is the reason why you may see a large difference between the actual size of your files and the “Size on disk” in some cases.
How to reduce the Size vs. size on disk difference
More Size on disk means more wastage. Hence, if you want to reduce the difference between the actual file size and the Size on disk, you need to reduce the allocation unit size.
You can see the difference between the actual size of the same file and the size it occupies on disk in two different situations. In the image where the Size on disk shows 6144 bytes, the Allocation unit size is 1024 bytes. In the second image where the “Size on disk” shows 32768 bytes, the Allocation size is 32 Kilobytes. Hence, it is clear that less Allocation unit size will give you the least difference between th Size and the “Size on disk” for your file(s).
To reduce the Allocation unit size or cluster size, follow the steps provided below. Before you start formatting your storage device or hard drive partition, copy its data to another storage device.
- Right-click on your storage device or hard drive partition.
- Select Format.
- Click on the Allocation unit size drop-down.
- Select an allocation size from the list of available options.
- Click Start to format your hard drive.
After successfully formatting your storage device or hard drive partition, you can copy your data back to it.
What does size on disk 0 mean?
The Size on disk in file properties can sometimes show you 0 bytes for the file you selected. This usually happens when the file does not contain enough data to be filled in clusters. When all the clusters are empty, the “Size on disk” shows 0 bytes.
What is disk size used for?
Disk size is used for storing data. You can view the size of your disk in the Disk Management app. If you are talking about the “Size on disk,” it is the number of bytes used to store data on the disk in clusters or allocation units.
Read next: What are Kibibytes (KiB), Mebibytes (MiB), and Gibibytes (GiB)?