IRONSOFTWAREHOME
Create ZIP
using IronZip;

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

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

' Create an empty ZIP
Using archive As New IronZipArchive()
    ' Add files to the ZIP
    archive.Add("./assets/image1.jpg")
    archive.Add("./assets/image2.jpg")
    archive.Add("./assets/image3.jpg")

    ' Export the ZIP
    archive.SaveAs("output.zip")
End Using
NuGet Download
PM > Install-Package IronZip
Create ZIP

Create ZIP

ZIP is a file compression and archiving format that reduces file sizes for efficient storage and transmission. It allows multiple files and directories to be combined into a single archive, typically with a '.zip' extension. ZIP archives are commonly used for data backup, software distribution, and file sharing. While this format is helpful for everyday digital tasks, managing many ZIP files or manually compressing archives can quickly become cumbersome and prone to human error. To streamline this process, we can use IronZip to create an archive with just a few lines of code, improving efficiency and automating these tedious tasks.

IronZIP

We first import the namespace IronZip to use the library. Afterward, we create a new ZIP archive utilizing the IronZipArchive constructor with the using statement, which creates an empty ZIP archive.

Adding Files to the Empty Archive

Before we save it, we can add some files to it with the Add method by providing the file's absolute path. You can add single or multiple files to the archive, and the files you can add range from images, as shown above, to documents, such as docx and PDF, to audio files, such as MP3, WAV, and even ZIP archives, to create a compressed archive within an archive.

For more information regarding the list of compatible files that you can add, please refer to the documentation here.

Saving and Exporting

We finally save the archive and export it using the SaveAs method, saving it as output.zip.

Learn to Read and Extract ZIP Files in C#
View on GitHub

Ready to Get Started?

Nuget Downloads 23,187Version:2026.9just released

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