Take the 2-minute tour ×

Does anyone know of a good open-source zipping library for .NET?

share|improve this question

closed as off-topic by Yan Sklyarenko, Tom Fenech, showdev, David, Divi Jun 24 at 0:19


  • "Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Yan Sklyarenko, Tom Fenech, showdev, David, Divi

7 Answers 7

up vote 31 down vote accepted


Regarding the comments and other posts about the internal gzip implementation, they are not the same! GZip does not create the header required for archiving; it is only useful for "zipping" one file or stream.

Proper zip archives contain a header that list all compressed files and where in the compressed data they come and therefore you need something that makes a header. That means SharpZipLib, one of the many commercial versions or using something external with .NET bindings like 7zip.

Just on the offchance somebody wants to say this: "But I see .gz files in Linux all the time!" - they're just single files and .tar.gz is no exception - tar is the archive file. The .gz is that archive compressed.

share|improve this answer
You don't need this .NET has build in functionality: see gzipstream class. –  AnthonyLambert Dec 17 '08 at 12:47
gzipstream is not anything nearby zip-functionality. –  BeowulfOF Dec 17 '08 at 13:00
I think you getting too caught up with the files... gzip is a general compression format. –  AnthonyLambert Dec 17 '08 at 13:16
Right, gzip is a compression format, but not for file-containers. And gzip is not zip. –  BeowulfOF Dec 18 '08 at 9:50
Unfortunately. SharpZipLib is currently unmaintained and somewhat buggy. –  Laurynas Biveinis Oct 8 '09 at 17:40

Couple comments.

  1. Don't use the J# runtime. J# has been discontinued by Microsoft. Future support is questionable. Also, the entire J# runtime is a big nut to swallow when all you want is ZIP support.
  2. The GzipStream in System.IO.Compression, part of the .NET base class library since .NET 2.0, provides a stream interface for IETF RFC-1952 compression. It is ok for compression, though the compression ratio is not optimal and it will significantly expand data that has been previously compressed. This bug was reported to Microsoft, but it's apparently been closed. There is also a DeflateStream which is similar, but for RFC 1951. There's a common misconception that GZipStream does zip files. Not true. Neither of these two do zip files.
  3. There's System.IO.Packaging.ZipPackage. It works, but is designed and intended primarily for packaging of MS Office 2007 (.docx, .xslx, and .pptx) files. It's unwieldy for zip files and doesn't support lots of ZIP features, like encryption.
  4. If you want a flexible way to create and read zip files in .NET you need a 3rd party library, currently.

DotNetZip is a good 3rd party option. Free, open source, actively maintained, simple to use, small, good feature set. It is shipped as a single assembly - it is fully managed code. Works on Compact Framework as well as on the regular .NET Framework. The pre-req is .NET 2.0.

DotNetZip also includes a ZLIB library, with classes like {Zlib,GZip,Deflate}Stream. They are comparable to those built-in to .NET, but they include the ability to set Compression Levels, and at higher levels they compress much more effectively than the built-in classes. The ZlibStream does RFC 1950 compression.

DotNetZip does ZIP64, passwords, AES encryption, streams, SFX, and Unicode. Everyone who uses it says it is much simpler to use than SharpZipLib. There's a good help file (.chm) and lots of code examples.


share|improve this answer
Do you know, can DotNetZip be included in an open source project? I heard that Microsoft Public License cannot be used together with a GPL. –  Zenya Oct 19 '10 at 7:36
First, I'm not an IP attorney or an expert on software licenses and their mutual compatibility. However, I am confident that I can answer your first question affirmatively: DotNetZip can be used in an open source project. There is a second, implied question in your comment: Can a library licensed under the MS-PL be used together with code or a library licensed under the GPL? That is a different question entirely, and I won't attempt to answer it. I'm not sure, but there may be an assumption on your part that "open source implies GPL". This is not a valid assumption. –  Cheeso Oct 24 '10 at 14:44
Great library, thanks! –  nrodic Mar 11 '13 at 15:58

The DotNet Zip Library (Ionic.Zip.dll) is very easy to use. I feel that it's easier to implement than SharpZip.


share|improve this answer
Does not expand some of the files that SharpZipLib does. –  Sergey Aldoukhov Oct 9 '09 at 4:04
which files does it not expand? –  Cheeso Nov 4 '09 at 17:21
@Sergey - Yeah, more details on the caveat? –  Matthew Sep 13 '12 at 3:05

Try checking out 7-zip. It's open source and my fav zip program. very kewl. takes advantage of multi cores also.

The .NET SDK is available here.

share|improve this answer
Dude - 7 zip IS a zipping program. It's also open source .. so that means it's .NET right? ==> C# source code for LZMA compression and decompression –  Pure.Krome Dec 17 '08 at 12:36
+1, SDK is public domain too, thats sounds real good to me. –  Tuminoid Dec 17 '08 at 12:42
A word of caution: the (safe) C# implementation of 7-zip is very, very much slower than the unmanaged library, something like 10x (private impression, didn't benchmark since the difference was so large). –  Anton Tykhyy Jun 30 '09 at 16:19

** But guys .NET Already supports open source zip....**


This is compatible with the GZIP libraries. I used this to compress c# data and decompress across the network in a C++ application. Works fine.


share|improve this answer
how does the compression ratio compare to 7-Zip ? –  Pure.Krome Dec 17 '08 at 12:50
Its the same as gZIP. –  AnthonyLambert Dec 17 '08 at 12:59
the system.io.compression namespace is not completly opened, the useful stuff is inside the microsoft.internal namespace. In system.io.compression is only the part usefull for creating small zipped files, like the new office files, not real zip files. –  BeowulfOF Dec 17 '08 at 13:00
Sorry, not real zip-files means no zip-file container, but data, that is packet by a deflate algorythm. Look at the functions in system.io.compression you will clearly see, that the purpose is another than microsoft.internal.zip -> what is what sharpziblib covers. –  BeowulfOF Dec 17 '08 at 17:49
NO, Russ - the .NET libraries in System.IO.Compression do not create or read ZIP files. I agree with Beowulf. You can try System.IO.Packaging, but that will leave you frustrated. a third party library is best. –  Cheeso Mar 7 '09 at 8:36

Give a look here if you want 7-zip with C#. This was a question in an other post at SO. This might help you.

share|improve this answer

you can also check out the J# redist. It re-implements java.util.zip. Article

share|improve this answer
