Work faster and get better results by blocking distracting websites while you work »

What’s the difference between a drive’s total and available free space?

Situation: Your C# application accessed a computer drive with an instance of the DriveInfo class. You noticed there are two very similar DriveInfo properties: TotalFreeSpace and AvailableFreeSpace. And in most cases both also return the same value. So let’s see what the difference between them is.

Discussion: AvailableFreeSpace versus TotalFreeSpace

In C#, we access drive information with an instance of the DriveInfo class, which resides in the System.IO namespace (Microsoft Docs, n.d.). A DriveInfo object has two very similar properties, that often also return the same value: AvailableFreeSpace and TotalFreeSpace.

The difference between those properties is the following (Hilyard & Teilhet, 2015):

A disk quota is an operating system feature that allows computer administrators to control how much data each user can store on a specific drive (MSDN, n.d.; Wikipedia, 2017). This way an administrator can prevent a single user from using all the file system’s resources.

So to know all free space a drive has, we use TotalFreeSpace. And to see which portion of disk space the current computer user can use (and by extension also our C# application the user runs), we use AvailableFreeSpace.

Because most drives do not use drive quotas, the TotalFreeSpace and AvailableFreeSpace properties often return the same value. But to accurately check the free space available, we better use the AvailableFreeSpace property.

Example: explore drive quotas in Windows

To make the above discussion more concrete, let’s explore how drive quotas work on a Windows computer. For that right-click on a drive in Windows Explorer and choose ‘Properties’. That opens a window with drive information. There select the ‘Quota’ tab to configure or view the drive’s quotas.

An example of a drive that uses disk quotas is:

Example of disk quota management in Windows

Here the drive quota is set to 50 GB, with a warning for when the user takes up 40 GB of disk space. With settings like this, TotalFreeSpace and AvailableFreeSpace report different values.

The TotalFreeSpace property will report the drive’s total amount of free space. But the value returned by AvailableFreeSpace will be the quote available to the current user. In this case, that returned value will match the 50 GB disk drive portion.

Now when the ‘Enable quota management’ option from that settings screen is turned off, the drive doesn’t use disk quotas. In that case both AvailableFreeSpace and TotalFreeSpace return the same value (Hilyard & Teilhet, 2015).

Say we don’t use disk quotas and got the following drive:

Example of a computer drive in Windows without disk quotas

The reported free space of this C:\ drive is 112,016,179,200 bytes. Without disk quotas, both TotalFreeSpace and AvailableFreeSpace return the same value. We can confirm that when we make a console application to access drive information for C:\, and then print the values of those properties:

Total free space:   112016179200
Available space:    112016179200

Learn more

  • In this recipe we explored the TotalFreeSpace and AvailableFreeSpace properties from the DriveInfo class. See access a computer drive programmatically in C# for how to create a DriveInfo instance and the different properties available.
  • To access the free space of a drive, that drive needs to be ready and accessible. Else our program runs into an exception and potentially crashes. See check if a drive is ready to accessfor more.


Hilyard, J. & Teilhet, S. (2015). C# 6.0 Cookbook (4th edition). Sebastopol, CA: O’Reilly Media.

Microsoft Docs (n.d.). DriveInfo Class. Retrieved on January 30, 2018, from

MSDN [Microsoft Developer Network]. Setting Disk Quotas. Retrieved on January 30, 2018, from

Wikipedia (2017, October 24). Disk quota. Retrieved on January 30, 2018, from