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 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#

Ready to Get Started?
Nuget Downloads 14,939 | Version: 2025.10 just released