Unzip Files in C#

In the previous post, you have learned different ways of zipping files and folders into ZIP archives using Aspose.ZIP for .NET. In this post, I’ll show you how to extract or unzip ZIP files in C#. We’ll also cover how to extract password-protected or AES encrypted ZIP archives in C#. This article is divided into the following sections:

C# API to Unzip ZIP Files - Free Download

Before we start, make sure you have downloaded and referenced Aspose.ZIP for .NET or installed its package using NuGet Package Manager in your project.

Unzip ZIP Files in C# .NET

The process of unzipping ZIP files could be achieved in two way:

  • Unzip each file in ZIP separately
  • Unzip files into a specified folder

In the first method, you can explicitly access and unzip each file in the ZIP archive. Furthermore, you can print the progress of the extraction process. Whereas, the second method simply unzips the files into the specified folder.

Extract Each File in ZIP in C#

The following are the steps to access and extract files and print the extraction progress in C#:

The following code sample shows how to extract files in a ZIP archive using C#.

C# Unzip ZIP Files into a Folder

The following steps are used to unzip ZIP files into a specific folder in C#.

The following C# code sample unzips ZIP files into a folder.

C# Extract Password-Protected ZIP Files

You can also unzip a password-protected ZIP archive using Aspose.ZIP for .NET. For this, you only need to specify the password using the ArchiveLoadOptions class that will be passed as a second parameter to the Archive’s constructor.

The following is the sample code to unzip a password-protected ZIP file.

C# Extract AES Encrypted ZIP Files

A ZIP archive can also be encrypted with AES encryption. Aspose.ZIP for .NET supports encrypting archives with AES128, AES192, and AES256 encryption methods. Unzipping an AES encrypted ZIP file is similar to unzipping password-protected ZIP files. Just specify the decryption password using ArchiveLoadOptions class and rest will be taken care of by the API.

The following code sample shows how to unzip AES encrypted ZIP files in C#.

C# Unzip Library - Get a Free API License

You can use Aspose.ZIP for .NET without evaluation limitations by getting a free temporary license.


In this article, you have learned how to unzip ZIP files using C#. Furthermore, you have seen how to unzip files in password-protected ZIP archives in C# .NET. The code samples have also demonstrated how to extract files in an encrypted ZIP archive in C#. You can explore more about Aspose.ZIP for .NET using documentation.