IRONSOFTWAREHOME

C# Tutorial: Create, Read & Extract ZIP Files

Curtis Chau
Curtis Chau
Updated: August 2, 2026

Create ZIP generates a new ZIP archive by selecting files or directories, specifying compression settings, and creating the archive.

Extract ZIP retrieves contents by specifying the source ZIP file, the destination folder, and extracting files and directories to the specified location.

In addition to these functions, IronZIP can also open an existing ZIP file, add more files to it, and then export the result as a new ZIP file containing all the included files.

Quickstart: Create or Extract a ZIP with IronZIP Easily

Get started fast - create, modify, or extract ZIP archives using IronZIP in just a few simple API calls. Perfect for developers who want to instantly work with archives without boilerplate.

  1. 1Install IronZIP with NuGet Package Manager

    PM > Install-Package IronZip

  2. 2Copy and run this code snippet.

    IronZipArchive.ExtractArchiveToDirectory("project.zip", "outputFolder");
    C#
  3. 3Deploy to test on your live environment

    Start using IronZIP in your project today with a free trial
    arrow pointer

Create an Archive Example

To create a ZIP archive object, you can conveniently use the using statement in C# along with the IronZipArchive constructor. IronZIP makes this process straightforward, allowing you to establish an empty ZIP archive with just a few lines of code.

Next, utilize the Add method to import your files into the ZIP archive. This method adds a single file at a time; call it once per file you want to include.

Lastly, use the SaveAs method to export the ZIP file.

using IronZip;

// Create an empty ZIP
using (var archive = new IronZipArchive())
{
    // Add files to the ZIP
    archive.Add("./assets/image1.png");
    archive.Add("./assets/image2.png");

    // Export the ZIP file
    archive.SaveAs("output.zip");
}

Unarchive an Archive to Folder

To retrieve the contents from a ZIP file, you can use the ExtractArchiveToDirectory method. Simply indicate the path of the target ZIP file and the directory where you want the extracted files to be placed.

using IronZip;

// Extract ZIP
IronZipArchive.ExtractArchiveToDirectory("output.zip", "extracted");

Add Files to An Existing Archive

You can efficiently modify an existing ZIP archive with additional files using IronZIP. The process begins by instantiating the ZIP archive object from an existing ZIP file path. Once the archive is opened, you can use the Add method to add files to the existing archive.

using IronZip;

// Open existing ZIP
using (var archive = new IronZipArchive("existing.zip"))
{
    // Add files
    archive.Add("./assets/image3.png");
    archive.Add("./assets/image4.png");

    // Export the ZIP file
    archive.SaveAs("result.zip");
}

With this functionality, you can efficiently update and expand your ZIP archives to suit your project's evolving needs. IronZIP makes the process of managing archives in your C# projects a breeze.

A similar approach can be achieved for other archive and compression formats such as TAR, GZIP, and BZIP2 using the IronTarArchive, IronGZipArchive, and IronBZip2Archive classes, respectively.

Frequently Asked Questions

How do I create a ZIP file in C# using IronZIP?

You can create a ZIP file in C# using IronZIP by instantiating the IronZipArchive class, adding files with the Add method, and then exporting the archive with the SaveAs method.

What methods are available in IronZIP to extract ZIP files?

IronZIP provides the ExtractArchiveToDirectory method, which allows you to specify the source ZIP file and the destination folder to extract files easily.

Can I add files to an existing ZIP archive using IronZIP?

Yes, IronZIP allows you to open an existing ZIP file and use the Add method to include more files before re-exporting the archive.

Does IronZIP support other formats besides ZIP?

Yes, IronZIP supports other formats such as TAR, GZIP, and BZIP2 through the IronTarArchive, IronGZipArchive, and IronBZip2Archive classes, respectively.

What is the minimal workflow for using IronZIP in a C# project?

The minimal workflow involves downloading the IronZIP library, instantiating IronZipArchive, adding files using the Add method, and extracting archives with the ExtractArchiveToDirectory method.

How can I use a single line of code to extract a ZIP file with IronZIP?

You can extract a ZIP file in one line using IronZIP with the following code: IronZipArchive.ExtractArchiveToDirectory("project.zip", "outputFolder").

Is it possible to modify an archive without creating a new one from scratch?

Yes, you can modify an existing ZIP archive by opening it with IronZipArchive, adding new files, and saving the updated archive with SaveAs.

How does IronZIP simplify the creation of a ZIP archive in C#?

IronZIP simplifies ZIP archive creation by using straightforward methods like Add and SaveAs, enabling developers to manage file compression efficiently within a few lines of code.

What are the key steps to extract a ZIP file using IronZIP?

Key steps include calling the ExtractArchiveToDirectory method, where you specify paths for the source ZIP file and target extraction directory for file placement.

Can I use IronZIP for compression tasks other than ZIP?

Yes, for other compression tasks, IronZIP supports formats like TAR, GZIP, and BZIP2 by utilizing respective classes such as IronTarArchive, IronGZipArchive, and IronBZip2Archive.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 23,187Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronZip
nuget.org/packages/IronZip/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronZip"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

  1. Download and unzip IronZIP to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronZip.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required